diff --git a/lib/bcoin/http/rpc.js b/lib/bcoin/http/rpc.js index fbc5c353..aa51dd85 100644 --- a/lib/bcoin/http/rpc.js +++ b/lib/bcoin/http/rpc.js @@ -3212,7 +3212,7 @@ RPC.prototype._toListTX = function _toListTX(tx, callback) { account: member.path.name, address: member.address.toBase58(self.network), category: receive ? 'receive' : 'send', - amount: +utils.btc(member.value), + amount: +utils.btc(details.getValue()), label: member.path.name, vout: 0, confirmations: details.confirmations, diff --git a/lib/bcoin/txdb.js b/lib/bcoin/txdb.js index 93c04afb..323f0f3d 100644 --- a/lib/bcoin/txdb.js +++ b/lib/bcoin/txdb.js @@ -2135,17 +2135,13 @@ Details.prototype.getValue = function getValue() { Details.prototype.getMember = function getMember() { var receive = this.isReceive(); + var vector = receive ? this.outputs : this.inputs; var i, member; - for (i = 0; i < this.outputs.length; i++) { - member = this.outputs[i]; - if (receive) { - if (!member.path) - continue; - } else { - if (member.path) - continue; - } + for (i = 0; i < vector.length; i++) { + member = vector[i]; + if (!member.path) + continue; return member; }