From 26b5e3749bf7f3df7a93ecee3561409a17c5afe0 Mon Sep 17 00:00:00 2001 From: pbca26 Date: Tue, 3 Apr 2018 17:58:46 +0300 Subject: [PATCH] spv listtransactions limit vin parse count to 10 items --- routes/shepherd/electrum/transactions.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/routes/shepherd/electrum/transactions.js b/routes/shepherd/electrum/transactions.js index 47a44da..40f81ad 100644 --- a/routes/shepherd/electrum/transactions.js +++ b/routes/shepherd/electrum/transactions.js @@ -1,6 +1,8 @@ const async = require('async'); const Promise = require('bluebird'); +const MAX_VOUT_LENGTH = 10; + module.exports = (shepherd) => { shepherd.sortTransactions = (transactions, sortBy) => { return transactions.sort((b, a) => { @@ -143,7 +145,7 @@ module.exports = (shepherd) => { const checkLoop = () => { index2++; - if (index2 === decodedTx.inputs.length) { + if (index2 === decodedTx.inputs.length || index2 === MAX_VOUT_LENGTH) { shepherd.log(`tx history decode inputs ${decodedTx.inputs.length} | ${index2} => main callback`, true); const _parsedTx = { network: decodedTx.network, @@ -199,8 +201,9 @@ module.exports = (shepherd) => { callback(); shepherd.log(`tx history main loop ${json.length} | ${index}`, true); + } else { + callback2(); } - callback2(); } if (_decodedInput.txid !== '0000000000000000000000000000000000000000000000000000000000000000') {