@leofcoin/workers 1.4.6 → 1.4.7

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.6",
3
+ "version": "1.4.7",
4
4
  "description": "Workers used in @leofcoin/chain",
5
5
  "type": "module",
6
6
  "exports": {
@@ -23,6 +23,7 @@ const run = async (blocks) => {
23
23
  const index = block.decoded.index
24
24
  console.log(`loaded block: ${hash} @${index} ${formatBytes(size)}`)
25
25
  // todo we don't want this, need shared state
26
+ block.decoded.transactions = block.decoded.transactions.sort((a, b) => a.nonce - b.nonce)
26
27
  resolve({ ...block.decoded, blockInfo: { hash, size, index } })
27
28
  })
28
29
  )
@@ -51,13 +51,14 @@ const runContract = async ({ decoded, hash, encoded }) => {
51
51
  contracts[hash] = await new Contract(...params)
52
52
  worker.postMessage({
53
53
  type: 'debug',
54
- messages: [`loaded contract: ${hash}`, `size: ${formatBytes(encoded.length)}`]
54
+ message: `loaded contract: ${hash} size: ${formatBytes(encoded.length)}`
55
55
  })
56
56
  } catch (e) {
57
57
  console.log(e)
58
58
  worker.postMessage({
59
59
  type: 'contractError',
60
- hash: await contractMessage.hash()
60
+ message: e.message,
61
+ hash
61
62
  })
62
63
  }
63
64
  }
@@ -123,7 +124,6 @@ const _init = async ({ contracts, blocks, peerid }) => {
123
124
  type: 'module'
124
125
  })
125
126
  blocks = await _worker.once(blocks)
126
- console.log({ blocks })
127
127
  _worker = null
128
128
  // blocks = unique(globalThis.blocks ? globalThis : [], blocks)
129
129
  // for (let i = 0; i < blocks.length; i++) {