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.
Files changed (3) hide show
  1. package/index.js +2 -0
  2. package/lib/core.js +1 -1
  3. 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)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore",
3
- "version": "11.20.0",
3
+ "version": "11.20.1",
4
4
  "description": "Hypercore is a secure, distributed append-only log",
5
5
  "main": "index.js",
6
6
  "scripts": {