@leofcoin/chain 1.4.55 → 1.4.56

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.
@@ -7884,6 +7884,7 @@ globalThis.BigNumber = BigNumber;
7884
7884
  // check if browser or local
7885
7885
  class Chain extends Contract {
7886
7886
  version;
7887
+ #resolveErrored;
7887
7888
  #state;
7888
7889
  #lastResolved;
7889
7890
  #slotTime = 10000;
@@ -8236,9 +8237,10 @@ class Chain extends Contract {
8236
8237
  if (!peer.version || peer.version !== this.version)
8237
8238
  return;
8238
8239
  const lastBlock = await this.#makeRequest(peer, 'lastBlock');
8239
- if (lastBlock && lastBlock.index > this.#lastBlock?.index) {
8240
+ if (this.#resolveErrored || lastBlock && lastBlock.index > this.#lastBlock?.index) {
8240
8241
  // this.#knownBlocks = await this.#makeRequest(peer, 'knownBlocks')
8241
8242
  console.log(lastBlock);
8243
+ this.#resolveErrored = false;
8242
8244
  if (lastBlock)
8243
8245
  await this.#syncChain(lastBlock);
8244
8246
  if (await this.hasTransactionToHandle())
@@ -8300,6 +8302,7 @@ class Chain extends Contract {
8300
8302
  }
8301
8303
  }
8302
8304
  catch (error) {
8305
+ this.#resolveErrored = true;
8303
8306
  console.error(error);
8304
8307
  }
8305
8308
  }
package/exports/chain.js CHANGED
@@ -470,6 +470,7 @@ globalThis.BigNumber = BigNumber;
470
470
  // check if browser or local
471
471
  class Chain extends Contract {
472
472
  version;
473
+ #resolveErrored;
473
474
  #state;
474
475
  #lastResolved;
475
476
  #slotTime = 10000;
@@ -822,9 +823,10 @@ class Chain extends Contract {
822
823
  if (!peer.version || peer.version !== this.version)
823
824
  return;
824
825
  const lastBlock = await this.#makeRequest(peer, 'lastBlock');
825
- if (lastBlock && lastBlock.index > this.#lastBlock?.index) {
826
+ if (this.#resolveErrored || lastBlock && lastBlock.index > this.#lastBlock?.index) {
826
827
  // this.#knownBlocks = await this.#makeRequest(peer, 'knownBlocks')
827
828
  console.log(lastBlock);
829
+ this.#resolveErrored = false;
828
830
  if (lastBlock)
829
831
  await this.#syncChain(lastBlock);
830
832
  if (await this.hasTransactionToHandle())
@@ -886,6 +888,7 @@ class Chain extends Contract {
886
888
  }
887
889
  }
888
890
  catch (error) {
891
+ this.#resolveErrored = true;
889
892
  console.error(error);
890
893
  }
891
894
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/chain",
3
- "version": "1.4.55",
3
+ "version": "1.4.56",
4
4
  "description": "Official javascript implementation",
5
5
  "exports": {
6
6
  "./node": "./exports/node.js",