hypercore 11.20.0 → 11.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2 -0
- package/lib/core.js +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -605,6 +605,8 @@ class Hypercore extends EventEmitter {
|
|
|
605
605
|
|
|
606
606
|
async setUserData(key, value) {
|
|
607
607
|
if (this.opened === false) await this.opening
|
|
608
|
+
const existing = await this.getUserData(key)
|
|
609
|
+
if (existing && b4a.isBuffer(value) && b4a.equals(existing, value)) return
|
|
608
610
|
await this.state.setUserData(key, value)
|
|
609
611
|
}
|
|
610
612
|
|
package/lib/core.js
CHANGED
|
@@ -282,7 +282,7 @@ module.exports = class Core {
|
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
const len = bitfield.findFirst(false, header.hints.contiguousLength)
|
|
285
|
-
if (header.hints.contiguousLength !== len) {
|
|
285
|
+
if (header.hints.contiguousLength !== len && !storage.readOnly) {
|
|
286
286
|
header.hints.contiguousLength = len
|
|
287
287
|
const tx = storage.write()
|
|
288
288
|
tx.setHints(header.hints)
|