@leofcoin/chain 1.4.18 → 1.4.19

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/chain.js +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/chain",
3
- "version": "1.4.18",
3
+ "version": "1.4.19",
4
4
  "description": "Official javascript implementation",
5
5
  "main": "./dist/node.js",
6
6
  "module": "./dist/chain.esm",
package/src/chain.js CHANGED
@@ -294,7 +294,7 @@ export default class Chain extends Contract {
294
294
  debug(`synced ${blocksSynced} ${blocksSynced > 1 ? 'blocks' : 'block'}`)
295
295
 
296
296
  const end = this.#blocks.length
297
- const start = this.#blocks.length - blocksSynced
297
+ const start = (this.#blocks.length - blocksSynced) - 1
298
298
  await this.#loadBlocks(this.blocks.slice(start))
299
299
  await this.#updateState(this.#blocks[this.#blocks.length - 1])
300
300
  this.#chainSyncing = false
@@ -391,7 +391,7 @@ async resolveBlock(hash) {
391
391
 
392
392
  async #addBlock(block) {
393
393
  // console.log(block);
394
- const blockMessage = await new BlockMessage(new Uint8Array(Object.values(block)))
394
+ const blockMessage = await new BlockMessage(block)
395
395
  await Promise.all(blockMessage.decoded.transactions
396
396
  .map(async transaction => transactionPoolStore.delete(transaction.hash)))
397
397
  const hash = await blockMessage.hash()