aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2020-10-01 00:17:09 -0700
committerAdam Soltys <[email protected]>2020-10-01 00:17:09 -0700
commitcd3977c1c8fedecbb344f774024c91a66be054de (patch)
tree764817bb09573246141a69812ee7b636a01dcc15 /lib
parenta338fc4587dad308fe23c25ba97635844755c7d5 (diff)
downloadcoinos-server-cd3977c1c8fedecbb344f774024c91a66be054de.tar.gz
coinos-server-cd3977c1c8fedecbb344f774024c91a66be054de.zip
add privkey column
Diffstat (limited to 'lib')
-rw-r--r--lib/buildtx.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/buildtx.js b/lib/buildtx.js
index 0f63f641..876f6fff 100644
--- a/lib/buildtx.js
+++ b/lib/buildtx.js
@@ -20,10 +20,12 @@ module.exports = async ({ address, amount, feeRate, replaceable, user }) => {
}
});
+
+ const addresses = [...new Set(payments.map(p => p.address))];
const utxos = [];
- for (let i = 0; i < payments.length; i++) {
+ for (let i = 0; i < addresses.length; i++) {
try {
- utxos.push(...(await axios.get(`${api}/address/${payments[i].address}/utxo`)).data);
+ utxos.push(...(await axios.get(`${api}/address/${addresses[i]}/utxo`)).data);
} catch (e) {
l.error("problem fetching utxos", e.message);
}