Merge pull request #733 from matiu/bug/tx-translation
fix translation of txs
This commit is contained in:
commit
acb14a1877
|
@ -63,14 +63,14 @@ Insight.prototype.translateResultAddresses = function(addresses) {
|
||||||
Insight.prototype.translateTx = function(tx) {
|
Insight.prototype.translateTx = function(tx) {
|
||||||
if (!this.shouldTranslateAddresses) return tx;
|
if (!this.shouldTranslateAddresses) return tx;
|
||||||
|
|
||||||
_.each(tx.input, function(x){
|
_.each(tx.vin, function(x){
|
||||||
if (x.addr) {
|
if (x.addr) {
|
||||||
x.addr = AddressTranslator.translateOutput(x.addr);
|
x.addr = AddressTranslator.translateOutput(x.addr);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
_.each(tx.output, function(x){
|
_.each(tx.vout, function(x){
|
||||||
if (x.scriptPubKey && x.scriptPubKey.addresses) {
|
if (x.scriptPubKey && x.scriptPubKey.addresses) {
|
||||||
x.scriptPubKey.addresses = AddressTranslator.translateOutput(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 (!_.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) {
|
if (self.shouldTranslateAddresses) {
|
||||||
|
|
||||||
_.each(txs, function(tx){
|
_.each(txs, function(tx){
|
||||||
self.translateTx(tx);
|
self.translateTx(tx);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue