aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2021-12-16 23:46:14 -0500
committerAdam Soltys <[email protected]>2021-12-16 23:46:14 -0500
commit6af2c1597081094d76494936494ee2c693a50f02 (patch)
tree5e5b6abdb1fcf63f44a6c5efd6f87bd37fc5530d
parent667302c91ceb1c1477782a6262d8d618ccd133e6 (diff)
downloadcoinos-server-6af2c1597081094d76494936494ee2c693a50f02.tar.gz
coinos-server-6af2c1597081094d76494936494ee2c693a50f02.zip
change to output address field
-rw-r--r--routes/bitcoin/send.js8
1 files changed, 3 insertions, 5 deletions
diff --git a/routes/bitcoin/send.js b/routes/bitcoin/send.js
index 470889b3..fe2b2862 100644
--- a/routes/bitcoin/send.js
+++ b/routes/bitcoin/send.js
@@ -8,7 +8,7 @@ module.exports = ah(async (req, res) => {
let fee = toSats(tx.fee);
if (fee < 0) throw new Error("fee cannot be negative");
- const isChange = async address =>
+ const isChange = async ({ address }) =>
(await bc.getAddressInfo(address)).ismine &&
!Object.keys(addresses).includes(address);
@@ -21,10 +21,8 @@ module.exports = ah(async (req, res) => {
let o = tx.vout[i];
total += toSats(o.value);
- if (o.scriptPubKey.addresses) {
- if (await isChange(o.scriptPubKey.addresses[0])) {
- change += toSats(o.value);
- }
+ if (await isChange(o.scriptPubKey)) {
+ change += toSats(o.value);
}
}