From 5e3846b7b8ad2e0fe11cade9c28a1fb0a3322b5d Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 30 Jun 2020 16:22:44 -0700 Subject: track unconfidential addresses for liquid invoices --- routes/invoices.js | 5 +++++ routes/payments.js | 1 + 2 files changed, 6 insertions(+) (limited to 'routes') diff --git a/routes/invoices.js b/routes/invoices.js index c6bf4b6e..bb2673cc 100644 --- a/routes/invoices.js +++ b/routes/invoices.js @@ -6,6 +6,10 @@ app.post("/invoice", auth, async (req, res) => { l.info("creating invoice", invoice.text, req.user.username, invoice.network, invoice.amount, invoice.tip, invoice.currency, invoice.rate.toFixed(2)); + if (invoice.network === 'LBTC') { + invoice.unconfidential = (await lq.getAddressInfo(invoice.address)).unconfidential; + } + const exists = await db.Invoice.findOne({ where: { [Op.or]: { @@ -15,6 +19,7 @@ app.post("/invoice", auth, async (req, res) => { } }); + res.send( exists ? await exists.update(invoice) : await db.Invoice.create(invoice) ); diff --git a/routes/payments.js b/routes/payments.js index f82262df..63ecb70b 100644 --- a/routes/payments.js +++ b/routes/payments.js @@ -21,6 +21,7 @@ const { join } = require("path"); as: 'user'}] }).map(i => { if (i.address && i.user) addresses[i.address] = i.user.username; + if (i.unconfidential && i.user) addresses[i.unconfidential] = i.user.username; }); payments = ( -- cgit v1.2.3