From 9f248357e692c89a65c6cd4c47b3a17bba96b1b1 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Tue, 14 Nov 2017 00:13:00 -0300 Subject: [PATCH] fix translation of txs --- lib/blockchainexplorers/insight.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/blockchainexplorers/insight.js b/lib/blockchainexplorers/insight.js index 9393bbd..6ed489d 100644 --- a/lib/blockchainexplorers/insight.js +++ b/lib/blockchainexplorers/insight.js @@ -63,14 +63,14 @@ Insight.prototype.translateResultAddresses = function(addresses) { Insight.prototype.translateTx = function(tx) { if (!this.shouldTranslateAddresses) return tx; - _.each(tx.input, function(x){ + _.each(tx.vin, function(x){ if (x.addr) { x.addr = AddressTranslator.translateOutput(x.addr); } }); - _.each(tx.output, function(x){ + _.each(tx.vout, function(x){ if (x.scriptPubKey && x.scriptPubKey.addresses) { x.scriptPubKey.addresses = AddressTranslator.translateOutput(x.scriptPubKey.addresses); } @@ -202,6 +202,7 @@ Insight.prototype.getTransactions = function(addresses, from, to, cb) { if (!_.isArray(txs) || (txs.length != _.compact(txs).length)) return cb(new Error('Could not retrieve transactions from blockchain. Request was:' + JSON.stringify(args))); if (self.shouldTranslateAddresses) { + _.each(txs, function(tx){ self.translateTx(tx); });