hypercore 11.35.3 → 11.35.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.
- package/index.js +4 -0
- package/lib/core.js +10 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -376,6 +376,10 @@ class Hypercore extends EventEmitter {
|
|
|
376
376
|
async _openSession(opts) {
|
|
377
377
|
if (this.core.opened === false) await this.core.ready()
|
|
378
378
|
|
|
379
|
+
if (opts.group && !this.core.header.group) {
|
|
380
|
+
await this.core.setGroup(opts.group)
|
|
381
|
+
}
|
|
382
|
+
|
|
379
383
|
if (this.keyPair === null) this.keyPair = opts.keyPair || this.core.header.keyPair
|
|
380
384
|
|
|
381
385
|
const parent = opts.parent || null
|
package/lib/core.js
CHANGED
|
@@ -154,6 +154,12 @@ module.exports = class Core {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
this.opened = true
|
|
157
|
+
|
|
158
|
+
// always make sure we get an initial update
|
|
159
|
+
if (this.state.length === 0 && !isWritableHeader(this.header)) {
|
|
160
|
+
this.replicator.setDownloading(true)
|
|
161
|
+
this.replicator.setDownloading(false)
|
|
162
|
+
}
|
|
157
163
|
}
|
|
158
164
|
|
|
159
165
|
async _tryOpen(opts) {
|
|
@@ -1034,6 +1040,10 @@ async function maybeGetRootsFromStorage(storage, length) {
|
|
|
1034
1040
|
}
|
|
1035
1041
|
}
|
|
1036
1042
|
|
|
1043
|
+
function isWritableHeader(header) {
|
|
1044
|
+
return !!(header && header.keyPair && header.keyPair.secretKey)
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1037
1047
|
function noop() {}
|
|
1038
1048
|
|
|
1039
1049
|
async function getCoreInfo(storage) {
|