fix translation of txs

This commit is contained in:
Matias Alejo Garcia 2017-11-14 00:13:00 -03:00
parent 616a8c40a7
commit 9f248357e6
No known key found for this signature in database
GPG Key ID: 02470DB551277AB3
1 changed files with 3 additions and 2 deletions

View File

@ -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);
});