diff options
| author | Adam Soltys <[email protected]> | 2020-08-09 22:13:47 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2020-08-09 22:13:47 -0700 |
| commit | f89b0ffde25292909bd398430e84e6c693084582 (patch) | |
| tree | 36e418ae2efffc8bcc57d44b0955b43782f8c475 /routes/bitcoin/receive.js | |
| parent | 23fa7f40f1cbc94238f836876a31480a4a23b785 (diff) | |
| download | coinos-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.js | 5 |
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(); |
