@leofcoin/chain 1.5.55 → 1.5.56

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.
@@ -3882,9 +3882,11 @@ class Machine {
3882
3882
  const { from, nonce, hash } = data.result;
3883
3883
  (await transactionPoolStore.has(hash)) && (await transactionPoolStore.delete(hash));
3884
3884
  await accountsStore.put(from, nonce);
3885
+ break;
3885
3886
  }
3886
3887
  case 'contractError': {
3887
- console.warn(`removing contract ${data.hash}`);
3888
+ console.warn(data.error);
3889
+ console.warn(`contract error: ${data.hash}`);
3888
3890
  // @ts-ignore
3889
3891
  await contractStore.delete(data.hash);
3890
3892
  break;
@@ -20,6 +20,7 @@ const run = async (blocks) => {
20
20
  const index = block.decoded.index;
21
21
  console.log(`loaded block: ${hash} @${index} ${formatBytes(size)}`);
22
22
  // todo we don't want this, need shared state
23
+ block.decoded.transactions = block.decoded.transactions.sort((a, b) => a.nonce - b.nonce);
23
24
  resolve({ ...block.decoded, blockInfo: { hash, size, index } });
24
25
  })
25
26
  )
@@ -62,13 +62,14 @@ const runContract = async ({ decoded, hash, encoded }) => {
62
62
  contracts[hash] = await new Contract(...params);
63
63
  worker.postMessage({
64
64
  type: 'debug',
65
- messages: [`loaded contract: ${hash}`, `size: ${formatBytes(encoded.length)}`]
65
+ message: `loaded contract: ${hash} size: ${formatBytes(encoded.length)}`
66
66
  });
67
67
  } catch (e) {
68
68
  console.log(e);
69
69
  worker.postMessage({
70
70
  type: 'contractError',
71
- hash: await contractMessage.hash()
71
+ message: e.message,
72
+ hash
72
73
  });
73
74
  }
74
75
  };
@@ -134,7 +135,6 @@ const _init = async ({ contracts, blocks, peerid }) => {
134
135
  type: 'module'
135
136
  });
136
137
  blocks = await _worker.once(blocks);
137
- console.log({ blocks });
138
138
  _worker = null;
139
139
  // blocks = unique(globalThis.blocks ? globalThis : [], blocks)
140
140
  // for (let i = 0; i < blocks.length; i++) {
package/exports/chain.js CHANGED
@@ -293,9 +293,11 @@ class Machine {
293
293
  const { from, nonce, hash } = data.result;
294
294
  (await transactionPoolStore.has(hash)) && (await transactionPoolStore.delete(hash));
295
295
  await accountsStore.put(from, nonce);
296
+ break;
296
297
  }
297
298
  case 'contractError': {
298
- console.warn(`removing contract ${data.hash}`);
299
+ console.warn(data.error);
300
+ console.warn(`contract error: ${data.hash}`);
299
301
  // @ts-ignore
300
302
  await contractStore.delete(data.hash);
301
303
  break;
@@ -20,6 +20,7 @@ const run = async (blocks) => {
20
20
  const index = block.decoded.index;
21
21
  console.log(`loaded block: ${hash} @${index} ${formatBytes(size)}`);
22
22
  // todo we don't want this, need shared state
23
+ block.decoded.transactions = block.decoded.transactions.sort((a, b) => a.nonce - b.nonce);
23
24
  resolve({ ...block.decoded, blockInfo: { hash, size, index } });
24
25
  })
25
26
  )
@@ -62,13 +62,14 @@ const runContract = async ({ decoded, hash, encoded }) => {
62
62
  contracts[hash] = await new Contract(...params);
63
63
  worker.postMessage({
64
64
  type: 'debug',
65
- messages: [`loaded contract: ${hash}`, `size: ${formatBytes(encoded.length)}`]
65
+ message: `loaded contract: ${hash} size: ${formatBytes(encoded.length)}`
66
66
  });
67
67
  } catch (e) {
68
68
  console.log(e);
69
69
  worker.postMessage({
70
70
  type: 'contractError',
71
- hash: await contractMessage.hash()
71
+ message: e.message,
72
+ hash
72
73
  });
73
74
  }
74
75
  };
@@ -134,7 +135,6 @@ const _init = async ({ contracts, blocks, peerid }) => {
134
135
  type: 'module'
135
136
  });
136
137
  blocks = await _worker.once(blocks);
137
- console.log({ blocks });
138
138
  _worker = null;
139
139
  // blocks = unique(globalThis.blocks ? globalThis : [], blocks)
140
140
  // for (let i = 0; i < blocks.length; i++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/chain",
3
- "version": "1.5.55",
3
+ "version": "1.5.56",
4
4
  "description": "Official javascript implementation",
5
5
  "exports": {
6
6
  "./node": {