hypercore 11.0.45 → 11.0.47
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/copy-prologue.js +7 -1
- package/lib/core.js +2 -1
- package/lib/session-state.js +1 -3
- package/package.json +1 -1
package/lib/copy-prologue.js
CHANGED
|
@@ -91,7 +91,13 @@ async function flushBatch (prologue, src, dst, batch) {
|
|
|
91
91
|
// reads done!
|
|
92
92
|
|
|
93
93
|
if (batch.first) {
|
|
94
|
-
const
|
|
94
|
+
const roots = nodes.slice(0, batch.roots.length)
|
|
95
|
+
|
|
96
|
+
for (const node of roots) {
|
|
97
|
+
if (!node) throw new Error('Missing nodes for prologue hash')
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const treeHash = crypto.tree(roots)
|
|
95
101
|
if (!b4a.equals(treeHash, prologue.hash)) throw new Error('Prologue does not match source')
|
|
96
102
|
}
|
|
97
103
|
|
package/lib/core.js
CHANGED
|
@@ -559,7 +559,8 @@ module.exports = class Core {
|
|
|
559
559
|
}
|
|
560
560
|
|
|
561
561
|
// tmp log so we can see these
|
|
562
|
-
|
|
562
|
+
const id = b4a.toString(this.discoveryKey, 'hex')
|
|
563
|
+
console.log('[hypercore] conflict detected in ' + id + ' (writable=' + !!this.header.keyPair + ',quorum=' + this.header.manifest.quorum + ')')
|
|
563
564
|
await this._onconflict(proof)
|
|
564
565
|
return true
|
|
565
566
|
}
|
package/lib/session-state.js
CHANGED
|
@@ -27,8 +27,6 @@ module.exports = class SessionState {
|
|
|
27
27
|
this.atomized = null
|
|
28
28
|
this.mutex = new Mutex()
|
|
29
29
|
|
|
30
|
-
this.treeFork = -1 // only updated if truncated below dependency
|
|
31
|
-
|
|
32
30
|
// merkle state
|
|
33
31
|
this.roots = treeInfo.roots.length ? treeInfo.roots : []
|
|
34
32
|
this.fork = treeInfo.fork || 0
|
|
@@ -111,7 +109,7 @@ module.exports = class SessionState {
|
|
|
111
109
|
}
|
|
112
110
|
|
|
113
111
|
get encryptionFork () {
|
|
114
|
-
return this.
|
|
112
|
+
return this.core.header.tree.fork
|
|
115
113
|
}
|
|
116
114
|
|
|
117
115
|
async updateSnapshotStorage (storage) {
|