Skip to content

Commit

Permalink
Add support to pass description_hash to LND
Browse files Browse the repository at this point in the history
  • Loading branch information
bumi committed Oct 19, 2021
1 parent 14478be commit ac2061c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion controllers/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit ac2061c

Please sign in to comment.