aboutsummaryrefslogtreecommitdiffstats
path: root/routes/bitcoin/receive.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2020-08-09 22:13:47 -0700
committerAdam Soltys <[email protected]>2020-08-09 22:13:47 -0700
commitf89b0ffde25292909bd398430e84e6c693084582 (patch)
tree36e418ae2efffc8bcc57d44b0955b43782f8c475 /routes/bitcoin/receive.js
parent23fa7f40f1cbc94238f836876a31480a4a23b785 (diff)
downloadcoinos-server-f89b0ffde25292909bd398430e84e6c693084582.tar.gz
coinos-server-f89b0ffde25292909bd398430e84e6c693084582.zip
handle receiving to non-custodial account
Diffstat (limited to 'routes/bitcoin/receive.js')
-rw-r--r--routes/bitcoin/receive.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/routes/bitcoin/receive.js b/routes/bitcoin/receive.js
index 1ee9f323..1c731118 100644
--- a/routes/bitcoin/receive.js
+++ b/routes/bitcoin/receive.js
@@ -59,13 +59,16 @@ zmqRawTx.on("message", async (topic, message, sequence) => {
let confirmed = false;
- const account = await db.Account.findOne({
+ const accounts = await db.Account.findAll({
where: {
user_id: user.id,
asset: config.liquid.btcasset,
},
});
+ let account = accounts.find(a => a.address === address);
+ if (!account) account = accounts[0];
+
account.pending += value;
await account.save();