@leofcoin/chain 1.8.25 → 1.8.27

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.
@@ -5286,6 +5286,9 @@ class State extends Contract {
5286
5286
  }
5287
5287
  try {
5288
5288
  const block = await this.getAndPutBlock(hash);
5289
+ if (block.decoded.previousHash !== '0x0' && block.decoded.previousHash !== localHash) {
5290
+ setImmediate(() => this.resolveBlock(block.decoded.previousHash));
5291
+ }
5289
5292
  await Promise.all(block.decoded.transactions
5290
5293
  .filter((hash) => Boolean(hash))
5291
5294
  .map(async (hash) => {
@@ -5329,11 +5332,14 @@ class State extends Contract {
5329
5332
  try {
5330
5333
  await this.jobber.add(() => this.#resolveBlock(hash));
5331
5334
  this.#resolving = false;
5332
- const lastBlockHash = await globalThis.stateStore.get('lastBlock');
5333
- if (lastBlockHash === hash) {
5334
- this.#resolveErrored = false;
5335
- return;
5335
+ try {
5336
+ const lastBlockHash = await globalThis.stateStore.get('lastBlock');
5337
+ if (lastBlockHash === hash) {
5338
+ this.#resolveErrored = false;
5339
+ return;
5340
+ }
5336
5341
  }
5342
+ catch (error) { }
5337
5343
  if (!this.#blockHashMap.has(this.#lastResolved.previousHash) && this.#lastResolved.previousHash !== '0x0')
5338
5344
  return this.resolveBlock(this.#lastResolved.previousHash);
5339
5345
  }
package/exports/chain.js CHANGED
@@ -1427,6 +1427,9 @@ class State extends Contract {
1427
1427
  }
1428
1428
  try {
1429
1429
  const block = await this.getAndPutBlock(hash);
1430
+ if (block.decoded.previousHash !== '0x0' && block.decoded.previousHash !== localHash) {
1431
+ setImmediate(() => this.resolveBlock(block.decoded.previousHash));
1432
+ }
1430
1433
  await Promise.all(block.decoded.transactions
1431
1434
  .filter((hash) => Boolean(hash))
1432
1435
  .map(async (hash) => {
@@ -1470,11 +1473,14 @@ class State extends Contract {
1470
1473
  try {
1471
1474
  await this.jobber.add(() => this.#resolveBlock(hash));
1472
1475
  this.#resolving = false;
1473
- const lastBlockHash = await globalThis.stateStore.get('lastBlock');
1474
- if (lastBlockHash === hash) {
1475
- this.#resolveErrored = false;
1476
- return;
1476
+ try {
1477
+ const lastBlockHash = await globalThis.stateStore.get('lastBlock');
1478
+ if (lastBlockHash === hash) {
1479
+ this.#resolveErrored = false;
1480
+ return;
1481
+ }
1477
1482
  }
1483
+ catch (error) { }
1478
1484
  if (!this.#blockHashMap.has(this.#lastResolved.previousHash) && this.#lastResolved.previousHash !== '0x0')
1479
1485
  return this.resolveBlock(this.#lastResolved.previousHash);
1480
1486
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/chain",
3
- "version": "1.8.25",
3
+ "version": "1.8.27",
4
4
  "description": "Official javascript implementation",
5
5
  "private": false,
6
6
  "exports": {