diff options
| author | Adam Soltys <[email protected]> | 2021-12-16 22:05:36 -0500 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2021-12-16 22:05:43 -0500 |
| commit | 667302c91ceb1c1477782a6262d8d618ccd133e6 (patch) | |
| tree | c51f0f21b2ea3c3cf51fe56b9890514cfbf3a543 /routes/liquid | |
| parent | 14d870dec052c4ae279933983d56ab6a0149bc1e (diff) | |
| download | coinos-server-667302c91ceb1c1477782a6262d8d618ccd133e6.tar.gz coinos-server-667302c91ceb1c1477782a6262d8d618ccd133e6.zip | |
check for payment existence
Diffstat (limited to 'routes/liquid')
| -rw-r--r-- | routes/liquid/receive.js | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/routes/liquid/receive.js b/routes/liquid/receive.js index 626cb21a..92942ce4 100644 --- a/routes/liquid/receive.js +++ b/routes/liquid/receive.js @@ -104,15 +104,29 @@ zmqRawTx.on("message", async (topic, message, sequence) => { let invoice = await db.Invoice.findOne({ where: { - unconfidential: address, + [Op.or]: { + unconfidential: address, + address + }, user_id: user.id, network: "liquid" }, - order: [["id", "DESC"]] + order: [["id", "DESC"]], + transaction }); if (!invoice) return; + let payment = await db.Payment.findOne({ + where: { + invoice_id: invoice.id, + }, + order: [["id", "DESC"]], + transaction + }); + + if (payment) return; + let confirmed = 0; let account = await db.Account.findOne({ @@ -156,7 +170,7 @@ zmqRawTx.on("message", async (topic, message, sequence) => { const tip = invoice ? invoice.tip : 0; const memo = invoice ? invoice.memo : ""; - let payment = await db.Payment.create( + payment = await db.Payment.create( { account_id: account.id, user_id: user.id, |
