hypercore 11.27.10 → 11.27.12

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
@@ -188,6 +188,11 @@ class Hypercore extends EventEmitter {
188
188
  return Replicator.clearRequests(session, err)
189
189
  }
190
190
 
191
+ static async treeHashFromStorage(session, length = session.length) {
192
+ const roots = await MerkleTree.getRoots(session.state, length)
193
+ return crypto.tree(roots)
194
+ }
195
+
191
196
  snapshot(opts) {
192
197
  return this.session({ ...opts, snapshot: true })
193
198
  }
@@ -124,7 +124,8 @@ class SessionState {
124
124
  }
125
125
 
126
126
  async _updateSnapshotStorage(storage) {
127
- while (this.atomized && this.atomized.flushing) await this.atomized.flushed()
127
+ if (!this.atomized || !this.atomized.flushing) return this.treeInfo()
128
+ while (this.atomized.flushing) await this.atomized.flushed()
128
129
 
129
130
  let rx = storage.read()
130
131
  const headPromise = rx.getHead()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore",
3
- "version": "11.27.10",
3
+ "version": "11.27.12",
4
4
  "description": "Hypercore is a secure, distributed append-only log",
5
5
  "main": "index.js",
6
6
  "scripts": {