@leofcoin/chain 1.7.17 → 1.7.18
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 +8 -7
- package/exports/chain.js +8 -7
- package/package.json +1 -1
package/exports/browser/chain.js
CHANGED
|
@@ -5190,7 +5190,7 @@ class Chain extends VersionControl {
|
|
|
5190
5190
|
data = transactionStore.get(hash);
|
|
5191
5191
|
}
|
|
5192
5192
|
(await transactionPoolStore.has(hash)) && (await transactionPoolStore.delete(hash));
|
|
5193
|
-
return new TransactionMessage(data)
|
|
5193
|
+
return new TransactionMessage(data);
|
|
5194
5194
|
}));
|
|
5195
5195
|
await globalThis.blockStore.put(hash, blockMessage.encoded);
|
|
5196
5196
|
debug(`added block: ${hash}`);
|
|
@@ -5199,10 +5199,10 @@ class Chain extends VersionControl {
|
|
|
5199
5199
|
const normalTransactions = [];
|
|
5200
5200
|
const priorityransactions = [];
|
|
5201
5201
|
for (const transaction of transactions) {
|
|
5202
|
-
if (!contracts.includes(transaction.to)) {
|
|
5203
|
-
contracts.push(transaction.to);
|
|
5202
|
+
if (!contracts.includes(transaction.decoded.to)) {
|
|
5203
|
+
contracts.push(transaction.decoded.to);
|
|
5204
5204
|
}
|
|
5205
|
-
if (transaction.priority)
|
|
5205
|
+
if (transaction.decoded.priority)
|
|
5206
5206
|
priorityransactions.push(transaction);
|
|
5207
5207
|
else
|
|
5208
5208
|
normalTransactions.push(transaction);
|
|
@@ -5225,10 +5225,11 @@ class Chain extends VersionControl {
|
|
|
5225
5225
|
const noncesByAddress = {};
|
|
5226
5226
|
for (let transaction of transactions) {
|
|
5227
5227
|
globalThis.pubsub.publish('transaction-processed', transaction);
|
|
5228
|
-
if (transaction.to === globalThis.peernet.selectedAccount)
|
|
5228
|
+
if (transaction.decoded.to === globalThis.peernet.selectedAccount)
|
|
5229
5229
|
globalThis.pubsub.publish('account-transaction-processed', transaction);
|
|
5230
|
-
if (!noncesByAddress[transaction.from] ||
|
|
5231
|
-
noncesByAddress[transaction.from]
|
|
5230
|
+
if (!noncesByAddress[transaction.decoded.from] ||
|
|
5231
|
+
noncesByAddress?.[transaction.decoded.from] < transaction.decoded.nonce) {
|
|
5232
|
+
noncesByAddress[transaction.decoded.from] = transaction.decoded.nonce;
|
|
5232
5233
|
}
|
|
5233
5234
|
}
|
|
5234
5235
|
await Promise.all(Object.entries(noncesByAddress).map(([from, nonce]) => globalThis.accountsStore.put(from, String(nonce))));
|
package/exports/chain.js
CHANGED
|
@@ -1557,7 +1557,7 @@ class Chain extends VersionControl {
|
|
|
1557
1557
|
data = transactionStore.get(hash);
|
|
1558
1558
|
}
|
|
1559
1559
|
(await transactionPoolStore.has(hash)) && (await transactionPoolStore.delete(hash));
|
|
1560
|
-
return new TransactionMessage(data)
|
|
1560
|
+
return new TransactionMessage(data);
|
|
1561
1561
|
}));
|
|
1562
1562
|
await globalThis.blockStore.put(hash, blockMessage.encoded);
|
|
1563
1563
|
debug(`added block: ${hash}`);
|
|
@@ -1566,10 +1566,10 @@ class Chain extends VersionControl {
|
|
|
1566
1566
|
const normalTransactions = [];
|
|
1567
1567
|
const priorityransactions = [];
|
|
1568
1568
|
for (const transaction of transactions) {
|
|
1569
|
-
if (!contracts.includes(transaction.to)) {
|
|
1570
|
-
contracts.push(transaction.to);
|
|
1569
|
+
if (!contracts.includes(transaction.decoded.to)) {
|
|
1570
|
+
contracts.push(transaction.decoded.to);
|
|
1571
1571
|
}
|
|
1572
|
-
if (transaction.priority)
|
|
1572
|
+
if (transaction.decoded.priority)
|
|
1573
1573
|
priorityransactions.push(transaction);
|
|
1574
1574
|
else
|
|
1575
1575
|
normalTransactions.push(transaction);
|
|
@@ -1592,10 +1592,11 @@ class Chain extends VersionControl {
|
|
|
1592
1592
|
const noncesByAddress = {};
|
|
1593
1593
|
for (let transaction of transactions) {
|
|
1594
1594
|
globalThis.pubsub.publish('transaction-processed', transaction);
|
|
1595
|
-
if (transaction.to === globalThis.peernet.selectedAccount)
|
|
1595
|
+
if (transaction.decoded.to === globalThis.peernet.selectedAccount)
|
|
1596
1596
|
globalThis.pubsub.publish('account-transaction-processed', transaction);
|
|
1597
|
-
if (!noncesByAddress[transaction.from] ||
|
|
1598
|
-
noncesByAddress[transaction.from]
|
|
1597
|
+
if (!noncesByAddress[transaction.decoded.from] ||
|
|
1598
|
+
noncesByAddress?.[transaction.decoded.from] < transaction.decoded.nonce) {
|
|
1599
|
+
noncesByAddress[transaction.decoded.from] = transaction.decoded.nonce;
|
|
1599
1600
|
}
|
|
1600
1601
|
}
|
|
1601
1602
|
await Promise.all(Object.entries(noncesByAddress).map(([from, nonce]) => globalThis.accountsStore.put(from, String(nonce))));
|