@leofcoin/chain 1.7.13 → 1.7.15

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.
@@ -4531,6 +4531,8 @@ class State extends Contract {
4531
4531
  const hash = await message.hash();
4532
4532
  await globalThis.chainStore.put('lastBlock', hash);
4533
4533
  globalThis.pubsub.publish('lastBlock', message.encoded);
4534
+ if (!this.#machine)
4535
+ this.#machine = await new Machine(this.#blocks);
4534
4536
  await this.#machine.updateState();
4535
4537
  }
4536
4538
  catch (error) {
@@ -4814,16 +4816,16 @@ class State extends Contract {
4814
4816
  if (block && !block.loaded) {
4815
4817
  try {
4816
4818
  let transactions = await this.#loadBlockTransactions([...block.transactions] || []);
4817
- const lastTransactions = await this.#getLastTransactions();
4819
+ // const lastTransactions = await this.#getLastTransactions()
4818
4820
  let priority = [];
4819
4821
  for (const transaction of transactions) {
4820
4822
  const hash = await transaction.hash();
4821
- if (lastTransactions.includes(hash)) {
4822
- console.log('removing invalid block');
4823
- await globalThis.blockStore.delete(await (await new BlockMessage(block)).hash());
4824
- blocks.splice(block.index - 1, 1);
4825
- return this.#loadBlocks(blocks);
4826
- }
4823
+ // if (lastTransactions.includes(hash)) {
4824
+ // console.log('removing invalid block')
4825
+ // await globalThis.blockStore.delete(await (await new BlockMessage(block)).hash())
4826
+ // blocks.splice(block.index - 1, 1)
4827
+ // return this.#loadBlocks(blocks)
4828
+ // }
4827
4829
  if (transaction.decoded.priority)
4828
4830
  priority.push(transaction);
4829
4831
  if (poolTransactionKeys.includes(hash))
package/exports/chain.js CHANGED
@@ -898,6 +898,8 @@ class State extends Contract {
898
898
  const hash = await message.hash();
899
899
  await globalThis.chainStore.put('lastBlock', hash);
900
900
  globalThis.pubsub.publish('lastBlock', message.encoded);
901
+ if (!this.#machine)
902
+ this.#machine = await new Machine(this.#blocks);
901
903
  await this.#machine.updateState();
902
904
  }
903
905
  catch (error) {
@@ -1181,16 +1183,16 @@ class State extends Contract {
1181
1183
  if (block && !block.loaded) {
1182
1184
  try {
1183
1185
  let transactions = await this.#loadBlockTransactions([...block.transactions] || []);
1184
- const lastTransactions = await this.#getLastTransactions();
1186
+ // const lastTransactions = await this.#getLastTransactions()
1185
1187
  let priority = [];
1186
1188
  for (const transaction of transactions) {
1187
1189
  const hash = await transaction.hash();
1188
- if (lastTransactions.includes(hash)) {
1189
- console.log('removing invalid block');
1190
- await globalThis.blockStore.delete(await (await new BlockMessage(block)).hash());
1191
- blocks.splice(block.index - 1, 1);
1192
- return this.#loadBlocks(blocks);
1193
- }
1190
+ // if (lastTransactions.includes(hash)) {
1191
+ // console.log('removing invalid block')
1192
+ // await globalThis.blockStore.delete(await (await new BlockMessage(block)).hash())
1193
+ // blocks.splice(block.index - 1, 1)
1194
+ // return this.#loadBlocks(blocks)
1195
+ // }
1194
1196
  if (transaction.decoded.priority)
1195
1197
  priority.push(transaction);
1196
1198
  if (poolTransactionKeys.includes(hash))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/chain",
3
- "version": "1.7.13",
3
+ "version": "1.7.15",
4
4
  "description": "Official javascript implementation",
5
5
  "private": false,
6
6
  "exports": {