hypercore 10.31.0 → 10.31.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.
Files changed (2) hide show
  1. package/lib/batch.js +3 -3
  2. package/package.json +1 -1
package/lib/batch.js CHANGED
@@ -70,9 +70,8 @@ module.exports = class HypercoreBatch extends EventEmitter {
70
70
  if (this.opened) return
71
71
 
72
72
  if (this._checkoutLength !== -1) {
73
- const batch = await this.session.core.tree.truncate(this._checkoutLength, this.session.fork)
74
- batch.upgraded = false
75
- batch.treeLength = batch.ancestors = this._checkoutLength
73
+ const batch = await this.session.core.tree.restoreBatch(this._checkoutLength)
74
+ batch.treeLength = this._checkoutLength
76
75
  if (this.opened) return
77
76
  this._sessionLength = batch.length
78
77
  this._sessionByteLength = batch.byteLength
@@ -82,6 +81,7 @@ module.exports = class HypercoreBatch extends EventEmitter {
82
81
 
83
82
  if (last > this.session.length) {
84
83
  const batch = await this.session.core.tree.restoreBatch(last)
84
+ if (this.opened) return
85
85
  this._sessionLength = batch.length
86
86
  this._sessionByteLength = batch.byteLength - this.session.padding * batch.length
87
87
  this._sessionBatch = batch
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore",
3
- "version": "10.31.0",
3
+ "version": "10.31.1",
4
4
  "description": "Hypercore is a secure, distributed append-only log",
5
5
  "main": "index.js",
6
6
  "scripts": {