Browse Source

Serialize calls to bitcoind RPC

Pavel Ševčík 3 years ago
parent
commit
0398e6cfba
No known key found for this signature in database GPG Key ID: CFA54E4C0CD58DF0
  1. 9
      tracker/mempool-processor.js

9
tracker/mempool-processor.js

@ -259,7 +259,10 @@ class MempoolProcessor {
const unconfirmedTxs = await db.getUnconfirmedTransactions()
if (unconfirmedTxs.length > 0) {
await util.parallelCall(unconfirmedTxs, tx => {
const unconfirmedTxLists = util.splitList(unconfirmedTxs, 10)
await util.seriesCall(unconfirmedTxLists, async (txList) => {
return await util.parallelCall(txList, tx => {
try {
return this.client.getrawtransaction( { txid: tx.txnTxid, verbose: true })
.then(async rtx => {
@ -271,7 +274,8 @@ class MempoolProcessor {
return db.confirmTransactions([tx.txnTxid], block.blockID)
}
},
() => {
(e) => {
Logger.error(e, 'Tracker : MempoolProcessor.checkUnconfirmed()')
// Transaction not in mempool. Update LRU cache and database
TransactionsBundle.cache.del(tx.txnTxid)
// TODO: Notify clients of orphaned transaction
@ -282,6 +286,7 @@ class MempoolProcessor {
Logger.error(e, 'Tracker : MempoolProcessor.checkUnconfirmed()')
}
})
})
}
// Logs

Loading…
Cancel
Save