From 9cc3165ec96d9a0237ebcebe94e2f3f9d7cfd0a0 Mon Sep 17 00:00:00 2001 From: Jack Mallers Date: Mon, 25 Sep 2017 01:27:15 -0500 Subject: [PATCH] fix(decodeInvoice): send pubkey back. can use to query routes and offer auto connect to peer and/or channel if no route --- app/lnd/utils/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/lnd/utils/index.js b/app/lnd/utils/index.js index 39cf69c0..7a29afc6 100644 --- a/app/lnd/utils/index.js +++ b/app/lnd/utils/index.js @@ -19,6 +19,9 @@ export function decodeInvoice(payreq) { + bufferHexRotated.substr(0, bufferHexRotated.length - 1) const buffer = Buffer.from(bufferHex, 'hex') + var pubkeyBuffer = buffer.slice(0, 33); + var pubkey = pubkeyBuffer.toString('hex'); + const paymentHashBuffer = buffer.slice(33, 65) const paymentHashHex = paymentHashBuffer.toString('hex') @@ -28,6 +31,7 @@ export function decodeInvoice(payreq) { return { payreq, + pubkey, amount, r_hash: paymentHashHex }