@leofcoin/chain 1.7.120 → 1.7.122
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/exports/browser/chain.js +5 -2
- package/exports/chain.js +5 -2
- package/package.json +1 -1
package/exports/browser/chain.js
CHANGED
|
@@ -5006,7 +5006,6 @@ class State extends Contract {
|
|
|
5006
5006
|
}
|
|
5007
5007
|
if (!lastBlock)
|
|
5008
5008
|
lastBlock = await this.#getLatestBlock();
|
|
5009
|
-
console.log('starting sync');
|
|
5010
5009
|
if (globalThis.peernet.peers.length === 0)
|
|
5011
5010
|
return 'connectionless';
|
|
5012
5011
|
try {
|
|
@@ -5053,7 +5052,7 @@ class State extends Contract {
|
|
|
5053
5052
|
let blocksSynced = localIndex > 0 ? (localIndex > index ? localIndex - index + 1 : index + -localIndex + 1) : index + 1;
|
|
5054
5053
|
debug$1(`synced ${blocksSynced} ${blocksSynced > 1 ? 'blocks' : 'block'}`);
|
|
5055
5054
|
const blocks = this.#blocks;
|
|
5056
|
-
const start =
|
|
5055
|
+
const start = localIndex + 1;
|
|
5057
5056
|
if (this.#machine) {
|
|
5058
5057
|
await this.#loadBlocks(blocks.slice(start));
|
|
5059
5058
|
}
|
|
@@ -5500,6 +5499,10 @@ class ConnectionMonitor {
|
|
|
5500
5499
|
console.log('🔁 Reconnection already in progress, skipping');
|
|
5501
5500
|
return;
|
|
5502
5501
|
}
|
|
5502
|
+
if (this.connectedPeers.length > 0) {
|
|
5503
|
+
console.log('✅ Already connected to peers, skipping restoration');
|
|
5504
|
+
return;
|
|
5505
|
+
}
|
|
5503
5506
|
this.#reconnecting = true;
|
|
5504
5507
|
console.log('🔁 Restoring network');
|
|
5505
5508
|
try {
|
package/exports/chain.js
CHANGED
|
@@ -1133,7 +1133,6 @@ class State extends Contract {
|
|
|
1133
1133
|
}
|
|
1134
1134
|
if (!lastBlock)
|
|
1135
1135
|
lastBlock = await this.#getLatestBlock();
|
|
1136
|
-
console.log('starting sync');
|
|
1137
1136
|
if (globalThis.peernet.peers.length === 0)
|
|
1138
1137
|
return 'connectionless';
|
|
1139
1138
|
try {
|
|
@@ -1180,7 +1179,7 @@ class State extends Contract {
|
|
|
1180
1179
|
let blocksSynced = localIndex > 0 ? (localIndex > index ? localIndex - index + 1 : index + -localIndex + 1) : index + 1;
|
|
1181
1180
|
debug$1(`synced ${blocksSynced} ${blocksSynced > 1 ? 'blocks' : 'block'}`);
|
|
1182
1181
|
const blocks = this.#blocks;
|
|
1183
|
-
const start =
|
|
1182
|
+
const start = localIndex + 1;
|
|
1184
1183
|
if (this.#machine) {
|
|
1185
1184
|
await this.#loadBlocks(blocks.slice(start));
|
|
1186
1185
|
}
|
|
@@ -1627,6 +1626,10 @@ class ConnectionMonitor {
|
|
|
1627
1626
|
console.log('🔁 Reconnection already in progress, skipping');
|
|
1628
1627
|
return;
|
|
1629
1628
|
}
|
|
1629
|
+
if (this.connectedPeers.length > 0) {
|
|
1630
|
+
console.log('✅ Already connected to peers, skipping restoration');
|
|
1631
|
+
return;
|
|
1632
|
+
}
|
|
1630
1633
|
this.#reconnecting = true;
|
|
1631
1634
|
console.log('🔁 Restoring network');
|
|
1632
1635
|
try {
|