hypercore 11.18.0 → 11.18.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 CHANGED
@@ -977,9 +977,18 @@ class Hypercore extends EventEmitter {
977
977
  async proof(opts) {
978
978
  if (this.opened === false) await this.opening
979
979
  const rx = this.state.storage.read()
980
- const promise = MerkleTree.proof(this.state, rx, opts)
980
+ const proofPromise = MerkleTree.proof(this.state, rx, opts)
981
+ const blockPromise = opts && opts.block ? rx.getBlock(opts.block.index) : null
981
982
  rx.tryFlush()
982
- return promise
983
+ const [proof, block] = await Promise.all([proofPromise, blockPromise])
984
+ const settled = await proof.settle()
985
+ if (block) settled.block.value = block
986
+ return settled
987
+ }
988
+
989
+ async applyProof(proof, from) {
990
+ if (this.opened === false) await this.opening
991
+ return this.core.verify(proof, from)
983
992
  }
984
993
 
985
994
  async verifyFullyRemote(proof) {
@@ -0,0 +1,10 @@
1
+ class HypercoreReadBatch {
2
+ constructor(core) {
3
+ this.core = core
4
+ this.gets = []
5
+ }
6
+
7
+ get(index) {}
8
+
9
+ tryFlush() {}
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore",
3
- "version": "11.18.0",
3
+ "version": "11.18.1",
4
4
  "description": "Hypercore is a secure, distributed append-only log",
5
5
  "main": "index.js",
6
6
  "scripts": {