hypercore 11.0.27 → 11.0.28
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/session-state.js +3 -1
- package/package.json +1 -1
package/lib/session-state.js
CHANGED
|
@@ -833,7 +833,7 @@ module.exports = class SessionState {
|
|
|
833
833
|
return { tree, flushed }
|
|
834
834
|
}
|
|
835
835
|
|
|
836
|
-
async commit (state, { signature, keyPair, length = state.length, treeLength =
|
|
836
|
+
async commit (state, { signature, keyPair, length = state.length, treeLength = -1, overwrite = false } = {}) {
|
|
837
837
|
assert(this.isDefault() || (this.parent && this.parent.isDefault()), 'Can only commit into default state')
|
|
838
838
|
|
|
839
839
|
let srcLocked = false
|
|
@@ -843,6 +843,8 @@ module.exports = class SessionState {
|
|
|
843
843
|
await state.mutex.lock()
|
|
844
844
|
srcLocked = true
|
|
845
845
|
|
|
846
|
+
if (treeLength === -1) treeLength = state.flushedLength()
|
|
847
|
+
|
|
846
848
|
if (!(await this.core._validateCommit(state, treeLength))) return null
|
|
847
849
|
if (this.length > length) return null
|
|
848
850
|
|