@leofcoin/workers 1.4.10 → 1.4.11

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/workers",
3
- "version": "1.4.10",
3
+ "version": "1.4.11",
4
4
  "description": "Workers used in @leofcoin/chain",
5
5
  "type": "module",
6
6
  "exports": {
@@ -21,7 +21,6 @@ const run = async (blocks) => {
21
21
  const size = block.encoded.length || block.encoded.byteLength
22
22
  const hash = await block.hash()
23
23
  const index = block.decoded.index
24
- console.log(`loaded block: ${hash} @${index} ${formatBytes(size)}`)
25
24
  resolve({ ...block.decoded, hash, blockInfo: { hash, size, index } })
26
25
  })
27
26
  )
@@ -28,7 +28,7 @@ const _ = {}
28
28
 
29
29
  globalThis.BigNumber = BigNumber
30
30
 
31
- let lastBlock = { index: 0, hash: '0x0', previousHash: '0x0' }
31
+ let lastBlock = { index: -1, hash: '0x0', previousHash: '0x0' }
32
32
 
33
33
  const unique = (arr) =>
34
34
  arr.filter((el, pos, arr) => {
@@ -281,7 +281,7 @@ worker.onmessage(({ id, type, input }) => {
281
281
  respond(id, blocks[input - 1])
282
282
  break
283
283
  case 'lastBlock':
284
- respond(id, blocks[blocks.length - 1])
284
+ respond(id, blocks[blocks.length - 1] || lastBlock)
285
285
  break
286
286
  case 'latestTransactions':
287
287
  respond(id, latestTransactions)