@leofcoin/chain 1.4.74 → 1.4.75

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.
@@ -1823,6 +1823,7 @@ class State extends Contract {
1823
1823
  #resolveErrored;
1824
1824
  #lastResolvedTime;
1825
1825
  #lastResolved;
1826
+ #resolving = false;
1826
1827
  #resolveErrorCount = 0;
1827
1828
  #syncState;
1828
1829
  #lastBlockInQue;
@@ -1976,7 +1977,11 @@ class State extends Contract {
1976
1977
  throw new Error(`expected hash, got: ${hash}`);
1977
1978
  if (hash === '0x0')
1978
1979
  return;
1980
+ if (this.#resolving)
1981
+ return 'already resolving';
1982
+ this.#resolving = true;
1979
1983
  await queue.add(() => this.#resolveBlock(hash));
1984
+ this.#resolving = false;
1980
1985
  if (!this.#blockHashMap.has(this.#lastResolved.previousHash) && this.#lastResolved.previousHash !== '0x0')
1981
1986
  return this.resolveBlock(this.#lastResolved.previousHash);
1982
1987
  return;
@@ -1992,6 +1997,7 @@ class State extends Contract {
1992
1997
  catch {
1993
1998
  this.#resolveErrored = true;
1994
1999
  this.#resolveErrorCount += 1;
2000
+ this.#resolving = false;
1995
2001
  // console.log(e);
1996
2002
  }
1997
2003
  }
package/exports/chain.js CHANGED
@@ -449,6 +449,7 @@ class State extends Contract {
449
449
  #resolveErrored;
450
450
  #lastResolvedTime;
451
451
  #lastResolved;
452
+ #resolving = false;
452
453
  #resolveErrorCount = 0;
453
454
  #syncState;
454
455
  #lastBlockInQue;
@@ -602,7 +603,11 @@ class State extends Contract {
602
603
  throw new Error(`expected hash, got: ${hash}`);
603
604
  if (hash === '0x0')
604
605
  return;
606
+ if (this.#resolving)
607
+ return 'already resolving';
608
+ this.#resolving = true;
605
609
  await queue.add(() => this.#resolveBlock(hash));
610
+ this.#resolving = false;
606
611
  if (!this.#blockHashMap.has(this.#lastResolved.previousHash) && this.#lastResolved.previousHash !== '0x0')
607
612
  return this.resolveBlock(this.#lastResolved.previousHash);
608
613
  return;
@@ -618,6 +623,7 @@ class State extends Contract {
618
623
  catch {
619
624
  this.#resolveErrored = true;
620
625
  this.#resolveErrorCount += 1;
626
+ this.#resolving = false;
621
627
  // console.log(e);
622
628
  }
623
629
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/chain",
3
- "version": "1.4.74",
3
+ "version": "1.4.75",
4
4
  "description": "Official javascript implementation",
5
5
  "exports": {
6
6
  "./node": "./exports/node.js",