diff options
Diffstat (limited to 'routes/bitcoin')
| -rw-r--r-- | routes/bitcoin/receive.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/routes/bitcoin/receive.js b/routes/bitcoin/receive.js index 5d8e21e7..e74f9394 100644 --- a/routes/bitcoin/receive.js +++ b/routes/bitcoin/receive.js @@ -68,6 +68,15 @@ zmqRawTx.on("message", async (topic, message, sequence) => { if (!invoice) return; + let payment = await db.Payment.findOne({ + where: { + invoice_id: invoice.id + }, + order: [["id", "DESC"]], + }); + + if (payment) return; + const currency = invoice ? invoice.currency : user.currency; const rate = invoice ? invoice.rate : app.get("rates")[user.currency]; const tip = invoice ? invoice.tip : 0; @@ -104,7 +113,7 @@ zmqRawTx.on("message", async (topic, message, sequence) => { } let fee = totalInputs - totalOutputs; - let payment = await db.Payment.create({ + payment = await db.Payment.create({ account_id: account.id, user_id: user.id, hash, |
