@leofcoin/chain 1.8.0 → 1.8.1
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 +10 -3
- package/exports/chain.js +10 -3
- package/package.json +1 -1
package/exports/browser/chain.js
CHANGED
|
@@ -4869,9 +4869,16 @@ class State extends Contract {
|
|
|
4869
4869
|
}
|
|
4870
4870
|
// Fetch all missing transactions in parallel
|
|
4871
4871
|
if (transactionsToFetch.length > 0) {
|
|
4872
|
-
const
|
|
4873
|
-
// Batch store all transactions
|
|
4874
|
-
|
|
4872
|
+
const fetchedResults = await Promise.allSettled(transactionsToFetch.map((txHash) => globalThis.peernet.get(txHash, 'transaction')));
|
|
4873
|
+
// Batch store all transactions that were successfully fetched
|
|
4874
|
+
for (let i = 0; i < fetchedResults.length; i++) {
|
|
4875
|
+
if (fetchedResults[i].status === 'fulfilled') {
|
|
4876
|
+
await globalThis.transactionStore.put(transactionsToFetch[i], fetchedResults[i].value);
|
|
4877
|
+
}
|
|
4878
|
+
else {
|
|
4879
|
+
debug$1(`failed to fetch transaction ${transactionsToFetch[i]}: ${fetchedResults[i].reason?.message || fetchedResults[i].reason}`);
|
|
4880
|
+
}
|
|
4881
|
+
}
|
|
4875
4882
|
}
|
|
4876
4883
|
// Remove from pool
|
|
4877
4884
|
await Promise.all(transactionHashes.map(async (txHash) => {
|
package/exports/chain.js
CHANGED
|
@@ -1010,9 +1010,16 @@ class State extends Contract {
|
|
|
1010
1010
|
}
|
|
1011
1011
|
// Fetch all missing transactions in parallel
|
|
1012
1012
|
if (transactionsToFetch.length > 0) {
|
|
1013
|
-
const
|
|
1014
|
-
// Batch store all transactions
|
|
1015
|
-
|
|
1013
|
+
const fetchedResults = await Promise.allSettled(transactionsToFetch.map((txHash) => globalThis.peernet.get(txHash, 'transaction')));
|
|
1014
|
+
// Batch store all transactions that were successfully fetched
|
|
1015
|
+
for (let i = 0; i < fetchedResults.length; i++) {
|
|
1016
|
+
if (fetchedResults[i].status === 'fulfilled') {
|
|
1017
|
+
await globalThis.transactionStore.put(transactionsToFetch[i], fetchedResults[i].value);
|
|
1018
|
+
}
|
|
1019
|
+
else {
|
|
1020
|
+
debug$1(`failed to fetch transaction ${transactionsToFetch[i]}: ${fetchedResults[i].reason?.message || fetchedResults[i].reason}`);
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1016
1023
|
}
|
|
1017
1024
|
// Remove from pool
|
|
1018
1025
|
await Promise.all(transactionHashes.map(async (txHash) => {
|