corestore 6.2.0 → 6.3.0

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 +5 -1
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -200,6 +200,7 @@ module.exports = class Corestore extends EventEmitter {
200
200
  if (this._root._closing) throw new Error('The corestore is closed')
201
201
  this.cores.set(id, core)
202
202
  core.ready().then(() => {
203
+ if (core.closing) return // extra safety here as ready is a tick after open
203
204
  for (const { stream } of this._replicationStreams) {
204
205
  core.replicate(stream, { session: true })
205
206
  }
@@ -209,6 +210,9 @@ module.exports = class Corestore extends EventEmitter {
209
210
  core.once('close', () => {
210
211
  this.cores.delete(id)
211
212
  })
213
+ core.on('conflict', (len, fork, proof) => {
214
+ this.emit('conflict', core, len, fork, proof)
215
+ })
212
216
 
213
217
  return { from: core, keyPair, auth }
214
218
  }
@@ -273,7 +277,7 @@ module.exports = class Corestore extends EventEmitter {
273
277
  })
274
278
 
275
279
  for (const core of this.cores.values()) {
276
- if (!core.opened) continue // If the core is not opened, it will be replicated in preload.
280
+ if (!core.opened || core.closing) continue // If the core is not opened, it will be replicated in preload.
277
281
  core.replicate(stream, { session: true })
278
282
  }
279
283
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "corestore",
3
- "version": "6.2.0",
3
+ "version": "6.3.0",
4
4
  "description": "A Hypercore factory that simplifies managing collections of cores.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "b4a": "^1.3.1",
33
- "hypercore": "^10.3.1",
33
+ "hypercore": "^10.5.3",
34
34
  "hypercore-crypto": "^3.2.1",
35
35
  "safety-catch": "^1.0.1",
36
36
  "sodium-universal": "^3.0.4",