@leofcoin/chain 1.7.18 → 1.7.20
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/exports/browser/chain.js +658 -681
- package/exports/chain.js +2 -8
- package/package.json +1 -1
package/exports/chain.js
CHANGED
|
@@ -1548,14 +1548,7 @@ class Chain extends VersionControl {
|
|
|
1548
1548
|
const transactions = await Promise.all(blockMessage.decoded.transactions
|
|
1549
1549
|
// @ts-ignore
|
|
1550
1550
|
.map(async (hash) => {
|
|
1551
|
-
|
|
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');
|
|
1559
1552
|
(await transactionPoolStore.has(hash)) && (await transactionPoolStore.delete(hash));
|
|
1560
1553
|
return new TransactionMessage(data);
|
|
1561
1554
|
}));
|
|
@@ -1652,6 +1645,7 @@ class Chain extends VersionControl {
|
|
|
1652
1645
|
block.transactions.push(hash);
|
|
1653
1646
|
block.fees = block.fees.add(await calculateFee(transaction.decoded));
|
|
1654
1647
|
await globalThis.accountsStore.put(transaction.decoded.from, new TextEncoder().encode(String(transaction.decoded.nonce)));
|
|
1648
|
+
await transactionStore.put(hash, await transaction.encode());
|
|
1655
1649
|
}
|
|
1656
1650
|
catch (e) {
|
|
1657
1651
|
console.log('vvvvvv');
|