diff options
| author | Adam Soltys <[email protected]> | 2021-12-16 23:46:14 -0500 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2021-12-16 23:46:14 -0500 |
| commit | 6af2c1597081094d76494936494ee2c693a50f02 (patch) | |
| tree | 5e5b6abdb1fcf63f44a6c5efd6f87bd37fc5530d | |
| parent | 667302c91ceb1c1477782a6262d8d618ccd133e6 (diff) | |
| download | coinos-server-6af2c1597081094d76494936494ee2c693a50f02.tar.gz coinos-server-6af2c1597081094d76494936494ee2c693a50f02.zip | |
change to output address field
| -rw-r--r-- | routes/bitcoin/send.js | 8 |
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); } } |
