Compare commits

...

2 Commits

Author SHA1 Message Date
k00b aba212f6ec don't abort on blinded path feature bits 2024-10-17 14:23:03 -05:00
k00b 6aac9eeed4 update breaking change in estimateRouteFee 2024-10-17 13:25:49 -05:00
3 changed files with 18 additions and 11 deletions

View File

@ -21,19 +21,24 @@ getWalletInfo({ lnd }, (err, result) => {
export async function estimateRouteFee ({ lnd, destination, tokens, mtokens, request, timeout }) {
return await new Promise((resolve, reject) => {
const params = {}
if (request) {
params.payment_request = request
} else {
params.dest = Buffer.from(destination, 'hex')
params.amt_sat = tokens ? toPositiveNumber(tokens) : toPositiveNumber(BigInt(mtokens) / BigInt(1e3))
}
lnd.router.estimateRouteFee({
dest: Buffer.from(destination, 'hex'),
amt_sat: tokens ? toPositiveNumber(tokens) : toPositiveNumber(BigInt(mtokens) / BigInt(1e3)),
payment_request: request,
...params,
timeout
}, (err, res) => {
if (err) {
reject(err)
return
}
if (res?.failure_reason) {
reject(new Error(`Unable to estimate route: ${res.failure_reason}`))
if (res?.failure_reason) {
reject(new Error(`Unable to estimate route: ${res.failure_reason}`))
} else {
reject(err)
}
return
}

View File

@ -1,4 +1,4 @@
FROM polarlightning/lnd:0.17.5-beta
FROM polarlightning/lnd:0.18.0-beta
ARG LN_NODE_FOR
ENV LN_NODE_FOR=$LN_NODE_FOR

View File

@ -36,7 +36,7 @@ export default async function wrapInvoice (bolt11, { msats, description, descrip
throw new Error('Unable to decode invoice')
}
console.log('invoice', inv.mtokens, inv.expires_at, inv.cltv_delta)
console.log('invoice', inv.id, inv.mtokens, inv.expires_at, inv.cltv_delta, inv.destination)
// validate outgoing amount
if (inv.mtokens) {
@ -77,6 +77,8 @@ export default async function wrapInvoice (bolt11, { msats, description, descrip
case 49:
case 149: // trampoline routing
case 151: // electrum trampoline routing
case 262:
case 263: // blinded paths
break
default:
throw new Error(`Unsupported feature bit: ${f.bit}`)