@leofcoin/chain 1.4.88 → 1.4.89

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.
@@ -2159,10 +2159,10 @@ class State extends Contract {
2159
2159
  if (!this.#lastBlock || Number(this.#lastBlock.index) < Number(lastBlock.index)) {
2160
2160
  // TODO: check if valid
2161
2161
  const localIndex = this.#lastBlock ? this.lastBlock.index : 0;
2162
- const index = lastBlock.index - 1;
2162
+ const index = lastBlock.index;
2163
2163
  await this.resolveBlock(lastBlock.hash);
2164
2164
  console.log('ok');
2165
- let blocksSynced = localIndex > 0 ? (localIndex > index ? localIndex - index : index - localIndex) : index;
2165
+ let blocksSynced = localIndex > 0 ? (localIndex > index ? localIndex - index : index + -localIndex) : index;
2166
2166
  globalThis.debug(`synced ${blocksSynced} ${blocksSynced > 1 ? 'blocks' : 'block'}`);
2167
2167
  const start = (this.#blocks.length - blocksSynced);
2168
2168
  if (this.#machine)
package/exports/chain.js CHANGED
@@ -779,10 +779,10 @@ class State extends Contract {
779
779
  if (!this.#lastBlock || Number(this.#lastBlock.index) < Number(lastBlock.index)) {
780
780
  // TODO: check if valid
781
781
  const localIndex = this.#lastBlock ? this.lastBlock.index : 0;
782
- const index = lastBlock.index - 1;
782
+ const index = lastBlock.index;
783
783
  await this.resolveBlock(lastBlock.hash);
784
784
  console.log('ok');
785
- let blocksSynced = localIndex > 0 ? (localIndex > index ? localIndex - index : index - localIndex) : index;
785
+ let blocksSynced = localIndex > 0 ? (localIndex > index ? localIndex - index : index + -localIndex) : index;
786
786
  globalThis.debug(`synced ${blocksSynced} ${blocksSynced > 1 ? 'blocks' : 'block'}`);
787
787
  const start = (this.#blocks.length - blocksSynced);
788
788
  if (this.#machine)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/chain",
3
- "version": "1.4.88",
3
+ "version": "1.4.89",
4
4
  "description": "Official javascript implementation",
5
5
  "exports": {
6
6
  "./node": "./exports/node.js",