hypercore 10.28.4 → 10.28.5

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/index.js +15 -11
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -300,18 +300,22 @@ module.exports = class Hypercore extends EventEmitter {
300
300
 
301
301
  if (isFirst) {
302
302
  await this._openCapabilities(key, storage, opts)
303
- // Only the root session should pass capabilities to other sessions.
304
- for (let i = 0; i < this.sessions.length; i++) {
305
- const s = this.sessions[i]
306
- if (s !== this) s._passCapabilities(this)
307
- }
308
303
 
309
- // copy state over
310
- if (this._clone) {
311
- const { from, signature } = this._clone
312
- await from.opening
313
- await this.core.copyFrom(from.core, signature)
314
- this._clone = null
304
+ // check we are the actual root and not a opts.from session
305
+ if (!opts.from) {
306
+ // Only the root session should pass capabilities to other sessions.
307
+ for (let i = 0; i < this.sessions.length; i++) {
308
+ const s = this.sessions[i]
309
+ if (s !== this) s._passCapabilities(this)
310
+ }
311
+
312
+ // copy state over
313
+ if (this._clone) {
314
+ const { from, signature } = this._clone
315
+ await from.opening
316
+ await this.core.copyFrom(from.core, signature)
317
+ this._clone = null
318
+ }
315
319
  }
316
320
  }
317
321
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore",
3
- "version": "10.28.4",
3
+ "version": "10.28.5",
4
4
  "description": "Hypercore is a secure, distributed append-only log",
5
5
  "main": "index.js",
6
6
  "scripts": {