@leofcoin/chain 1.7.121 → 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.
@@ -5052,7 +5052,7 @@ class State extends Contract {
5052
5052
  let blocksSynced = localIndex > 0 ? (localIndex > index ? localIndex - index + 1 : index + -localIndex + 1) : index + 1;
5053
5053
  debug$1(`synced ${blocksSynced} ${blocksSynced > 1 ? 'blocks' : 'block'}`);
5054
5054
  const blocks = this.#blocks;
5055
- const start = localIndex - blocksSynced;
5055
+ const start = localIndex + 1;
5056
5056
  if (this.#machine) {
5057
5057
  await this.#loadBlocks(blocks.slice(start));
5058
5058
  }
@@ -5499,6 +5499,10 @@ class ConnectionMonitor {
5499
5499
  console.log('🔁 Reconnection already in progress, skipping');
5500
5500
  return;
5501
5501
  }
5502
+ if (this.connectedPeers.length > 0) {
5503
+ console.log('✅ Already connected to peers, skipping restoration');
5504
+ return;
5505
+ }
5502
5506
  this.#reconnecting = true;
5503
5507
  console.log('🔁 Restoring network');
5504
5508
  try {
package/exports/chain.js CHANGED
@@ -1179,7 +1179,7 @@ class State extends Contract {
1179
1179
  let blocksSynced = localIndex > 0 ? (localIndex > index ? localIndex - index + 1 : index + -localIndex + 1) : index + 1;
1180
1180
  debug$1(`synced ${blocksSynced} ${blocksSynced > 1 ? 'blocks' : 'block'}`);
1181
1181
  const blocks = this.#blocks;
1182
- const start = localIndex - blocksSynced;
1182
+ const start = localIndex + 1;
1183
1183
  if (this.#machine) {
1184
1184
  await this.#loadBlocks(blocks.slice(start));
1185
1185
  }
@@ -1626,6 +1626,10 @@ class ConnectionMonitor {
1626
1626
  console.log('🔁 Reconnection already in progress, skipping');
1627
1627
  return;
1628
1628
  }
1629
+ if (this.connectedPeers.length > 0) {
1630
+ console.log('✅ Already connected to peers, skipping restoration');
1631
+ return;
1632
+ }
1629
1633
  this.#reconnecting = true;
1630
1634
  console.log('🔁 Restoring network');
1631
1635
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/chain",
3
- "version": "1.7.121",
3
+ "version": "1.7.122",
4
4
  "description": "Official javascript implementation",
5
5
  "private": false,
6
6
  "exports": {