From ac2061c6edad25ab87a022ca6ec147e28f97ed8b Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Tue, 19 Oct 2021 20:22:31 +0200 Subject: [PATCH] Add support to pass description_hash to LND --- controllers/api.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/controllers/api.js b/controllers/api.js index 3309a6e4..d50622b3 100644 --- a/controllers/api.js +++ b/controllers/api.js @@ -188,8 +188,12 @@ router.post('/addinvoice', postLimiter, async function (req, res) { const invoice = new Invo(redis, bitcoinclient, lightning); const r_preimage = invoice.makePreimageHex(); + const invoice_args = { memo: req.body.memo, value: req.body.amt, expiry: 3600 * 24, r_preimage: Buffer.from(r_preimage, 'hex').toString('base64') }; + if (req.body.description_hash) { + invoice_args.description_hash = Buffer.from(req.body.description_hash, 'hex').toString('base64') + } lightning.addInvoice( - { memo: req.body.memo, value: req.body.amt, expiry: 3600 * 24, r_preimage: Buffer.from(r_preimage, 'hex').toString('base64') }, + invoice_args, async function (err, info) { if (err) return errorLnd(res);