hypercore 10.36.3 → 10.36.4
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/lib/core.js +1 -1
- package/lib/merkle-tree.js +3 -1
- package/package.json +1 -1
package/lib/core.js
CHANGED
|
@@ -615,7 +615,7 @@ module.exports = class Core {
|
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
617
|
|
|
618
|
-
await this.blocks.putBatch(treeLength, adding
|
|
618
|
+
await this.blocks.putBatch(treeLength, adding < values.length ? values.slice(0, adding) : values, byteOffset)
|
|
619
619
|
await this.oplog.append([entry], false)
|
|
620
620
|
|
|
621
621
|
this._setBitfieldRange(entry.bitfield.start, entry.bitfield.length, true)
|
package/lib/merkle-tree.js
CHANGED
|
@@ -4,7 +4,7 @@ const c = require('compact-encoding')
|
|
|
4
4
|
const Xache = require('xache')
|
|
5
5
|
const b4a = require('b4a')
|
|
6
6
|
const caps = require('./caps')
|
|
7
|
-
const { INVALID_PROOF, INVALID_CHECKSUM, INVALID_OPERATION, BAD_ARGUMENT } = require('hypercore-errors')
|
|
7
|
+
const { INVALID_PROOF, INVALID_CHECKSUM, INVALID_OPERATION, BAD_ARGUMENT, ASSERTION } = require('hypercore-errors')
|
|
8
8
|
|
|
9
9
|
const BLANK_HASH = b4a.alloc(32)
|
|
10
10
|
const OLD_TREE = b4a.from([5, 2, 87, 2, 0, 0, 40, 7, 66, 76, 65, 75, 69, 50, 98])
|
|
@@ -767,6 +767,8 @@ async function getByteOffset (tree, index) {
|
|
|
767
767
|
|
|
768
768
|
return offset
|
|
769
769
|
}
|
|
770
|
+
|
|
771
|
+
throw ASSERTION('Failed to find offset')
|
|
770
772
|
}
|
|
771
773
|
|
|
772
774
|
// All the methods needed for proof verification
|