@leofcoin/chain 1.6.4 → 1.6.6

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.
@@ -4628,7 +4628,7 @@ class State extends Contract {
4628
4628
  const index = lastBlock.index;
4629
4629
  await this.resolveBlock(lastBlock.hash);
4630
4630
  console.log('ok');
4631
- let blocksSynced = localIndex > 0 ? (localIndex > index ? localIndex - index : index + -localIndex) : index;
4631
+ let blocksSynced = localIndex > 0 ? (localIndex > index ? localIndex - index + 1 : index + -localIndex + 1) : index + 1;
4632
4632
  debug$1(`synced ${blocksSynced} ${blocksSynced > 1 ? 'blocks' : 'block'}`);
4633
4633
  const blocks = this.#blocks;
4634
4634
  const start = blocks.length - blocksSynced;
@@ -4758,7 +4758,7 @@ class State extends Contract {
4758
4758
  }
4759
4759
  transactions = transactions.filter((transaction) => !transaction.decoded.priority);
4760
4760
  await Promise.all(transactions.map((transaction) => this.#_executeTransaction(transaction)));
4761
- this.#blocks[block.index - 1].loaded = true;
4761
+ this.#blocks[block.index].loaded = true;
4762
4762
  await this.#machine.addLoadedBlock(block);
4763
4763
  // @ts-ignore
4764
4764
  debug$1(`loaded block: ${block.hash} @${block.index}`);
package/exports/chain.js CHANGED
@@ -996,7 +996,7 @@ class State extends Contract {
996
996
  const index = lastBlock.index;
997
997
  await this.resolveBlock(lastBlock.hash);
998
998
  console.log('ok');
999
- let blocksSynced = localIndex > 0 ? (localIndex > index ? localIndex - index : index + -localIndex) : index;
999
+ let blocksSynced = localIndex > 0 ? (localIndex > index ? localIndex - index + 1 : index + -localIndex + 1) : index + 1;
1000
1000
  debug$1(`synced ${blocksSynced} ${blocksSynced > 1 ? 'blocks' : 'block'}`);
1001
1001
  const blocks = this.#blocks;
1002
1002
  const start = blocks.length - blocksSynced;
@@ -1126,7 +1126,7 @@ class State extends Contract {
1126
1126
  }
1127
1127
  transactions = transactions.filter((transaction) => !transaction.decoded.priority);
1128
1128
  await Promise.all(transactions.map((transaction) => this.#_executeTransaction(transaction)));
1129
- this.#blocks[block.index - 1].loaded = true;
1129
+ this.#blocks[block.index].loaded = true;
1130
1130
  await this.#machine.addLoadedBlock(block);
1131
1131
  // @ts-ignore
1132
1132
  debug$1(`loaded block: ${block.hash} @${block.index}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/chain",
3
- "version": "1.6.4",
3
+ "version": "1.6.6",
4
4
  "description": "Official javascript implementation",
5
5
  "private": false,
6
6
  "exports": {