From 192053cdee8ddb943c6813b40f52b97240e43476 Mon Sep 17 00:00:00 2001 From: gaeacodes Date: Fri, 12 Feb 2021 11:19:01 +0530 Subject: [PATCH 1/2] changes back to series to prevent rpc queue exceeded error --- lib/services/bitcoind.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/services/bitcoind.js b/lib/services/bitcoind.js index 0537e597..d5f24adc 100644 --- a/lib/services/bitcoind.js +++ b/lib/services/bitcoind.js @@ -2171,7 +2171,7 @@ Bitcoin.prototype.getDetailedTransaction = function (txid, callback) { let transactionData = {}; async.series( [ - function (callback1) { + function (callback) { client.getRawTransaction(txid, 1, function (err, response) { if (err) { return done(self._wrapRPCError(err)); @@ -2237,10 +2237,10 @@ Bitcoin.prototype.getDetailedTransaction = function (txid, callback) { transactionData.txid = txid; transactionData.tx = tx; - callback1(null, tx); + callback(null, tx); }); }, - function (callback2) { + function (callback) { var tx = transactionData.tx; var txid = transactionData.txid; var vins = tx.inputs; @@ -2265,14 +2265,14 @@ Bitcoin.prototype.getDetailedTransaction = function (txid, callback) { satoshis: vins[i].satoshis, }; rewards = getKomodoRewards(rewardData); - callback3(null, { + callback(null, { rewards: rewards, prevTxnLocktime: result.locktime, }); } ); } else { - callback3(null, { + callback(null, { rewards: 0, prevTxnLocktime: null, }); @@ -2280,7 +2280,7 @@ Bitcoin.prototype.getDetailedTransaction = function (txid, callback) { }); } - async.parallel(functionsArray, function (err, res) { + async.series(functionsArray, function (err, res) { var totalReward = 0; for (let i = 0; i < res.length; i++) { @@ -2307,12 +2307,14 @@ Bitcoin.prototype.getDetailedTransaction = function (txid, callback) { tx.inputSatoshis + tx.rewardClaimed * 1e8 - tx.outputSatoshis; transactionData.txid = txid; transactionData.tx = tx; - callback2(null, tx); + callback(null, tx); }); }, ], function (err, results) { var tx = transactionData.tx; + var txid = transactionData.txid; + self.transactionDetailedCache.set(txid, tx); done(null, tx); } ); From d5cc7d06e6f0e548dff6e94b8e422b1935ec00ab Mon Sep 17 00:00:00 2001 From: gaeacodes Date: Fri, 12 Feb 2021 11:33:40 +0530 Subject: [PATCH 2/2] cleanup --- lib/services/bitcoind.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/services/bitcoind.js b/lib/services/bitcoind.js index d5f24adc..2953ede0 100644 --- a/lib/services/bitcoind.js +++ b/lib/services/bitcoind.js @@ -2246,7 +2246,7 @@ Bitcoin.prototype.getDetailedTransaction = function (txid, callback) { var vins = tx.inputs; var functionsArray = []; for (let i = 0; i < vins.length; i++) { - functionsArray.push(function (callback3) { + functionsArray.push(function (callback) { var prevTxId = vins[i].prevTxId || null; var rewards = 0; if (prevTxId) {