Merge pull request #733 from matiu/bug/tx-translation

fix translation of txs
This commit is contained in:
Matias Alejo Garcia 2017-11-14 00:13:43 -03:00 committed by GitHub
commit acb14a1877
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);
});