@leofcoin/chain 1.7.18 → 1.7.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.
@@ -5181,14 +5181,8 @@ class Chain extends VersionControl {
5181
5181
  const transactions = await Promise.all(blockMessage.decoded.transactions
5182
5182
  // @ts-ignore
5183
5183
  .map(async (hash) => {
5184
- let data;
5185
- if (!(await transactionStore.has(hash))) {
5186
- data = await peernet.get(hash, 'transaction');
5187
- transactionStore.put(hash, data);
5188
- }
5189
- else {
5190
- data = transactionStore.get(hash);
5191
- }
5184
+ const data = await peernet.get(hash, 'transaction');
5185
+ transactionStore.put(hash, data);
5192
5186
  (await transactionPoolStore.has(hash)) && (await transactionPoolStore.delete(hash));
5193
5187
  return new TransactionMessage(data);
5194
5188
  }));
@@ -5285,6 +5279,7 @@ class Chain extends VersionControl {
5285
5279
  block.transactions.push(hash);
5286
5280
  block.fees = block.fees.add(await calculateFee(transaction.decoded));
5287
5281
  await globalThis.accountsStore.put(transaction.decoded.from, new TextEncoder().encode(String(transaction.decoded.nonce)));
5282
+ await transactionStore.put(hash, await transaction.encode());
5288
5283
  }
5289
5284
  catch (e) {
5290
5285
  console.log('vvvvvv');
package/exports/chain.js CHANGED
@@ -1548,14 +1548,8 @@ class Chain extends VersionControl {
1548
1548
  const transactions = await Promise.all(blockMessage.decoded.transactions
1549
1549
  // @ts-ignore
1550
1550
  .map(async (hash) => {
1551
- let data;
1552
- if (!(await transactionStore.has(hash))) {
1553
- data = await peernet.get(hash, 'transaction');
1554
- transactionStore.put(hash, data);
1555
- }
1556
- else {
1557
- data = transactionStore.get(hash);
1558
- }
1551
+ const data = await peernet.get(hash, 'transaction');
1552
+ transactionStore.put(hash, data);
1559
1553
  (await transactionPoolStore.has(hash)) && (await transactionPoolStore.delete(hash));
1560
1554
  return new TransactionMessage(data);
1561
1555
  }));
@@ -1652,6 +1646,7 @@ class Chain extends VersionControl {
1652
1646
  block.transactions.push(hash);
1653
1647
  block.fees = block.fees.add(await calculateFee(transaction.decoded));
1654
1648
  await globalThis.accountsStore.put(transaction.decoded.from, new TextEncoder().encode(String(transaction.decoded.nonce)));
1649
+ await transactionStore.put(hash, await transaction.encode());
1655
1650
  }
1656
1651
  catch (e) {
1657
1652
  console.log('vvvvvv');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/chain",
3
- "version": "1.7.18",
3
+ "version": "1.7.19",
4
4
  "description": "Official javascript implementation",
5
5
  "private": false,
6
6
  "exports": {