ln-service icon indicating copy to clipboard operation
ln-service copied to clipboard

`payviapaymentrequest` default behavior is different than `lncli payinvoice`

Open pseudozach opened this issue 2 years ago • 7 comments

I'm having an issue using payviapaymentrequest. Trying to pay an invoice with this command fails while directly calling lncli payinvoice succeeds.

Here's the error I get

[ 503, 'PaymentPathfindingFailedToFindPossibleRoute' ]

Meanwhile lncli payinvoice was able to pay the same invoice in 3 hops and + 40.111 sat fees.

Is there any easy way to find out what the difference in default parameters are? I think this library should also have the same defaults as the expectation is to use the underlying node commands.

pseudozach avatar Oct 24 '22 18:10 pseudozach

No arguments other than lnd and the request?

alexbosworth avatar Oct 24 '22 18:10 alexbosworth

Can you share any more information about the working payment that happened in lncli payinvoice? maybe the result of looking up the payment itself?

alexbosworth avatar Oct 24 '22 18:10 alexbosworth

Here's the script part:

console.log('pzinvoice: ', pzinvoice); const paid = await lnService.payViaPaymentRequest({lnd, request: pzinvoice});

Here's output from my script vs manual command. I didn't do lookupinvoice or get routes with lncli.

xxx scripts ₿ node balancemonitor.js (node:28015) [DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permitted by RFC 6066. This will be ignored in a future version. (Use node --trace-deprecation ... to show where the warning was created) pzchannel exists?, pzchannelBalance, balanceInChannels, maxSendable 95103 230939 115747 pzinvoice: lnbc957470n1p34dk0app5sfhm44nsc70s3hflh9nstvqy6nd8m9qdqx0yjkp2avaq50j297jqdpsvfskcctwvdjjqumdwv68xct5wvs8gmeqwpazq6twwehkjcm9cqzpgxqyz5vqsp5hz64aumq5pctf2d7lge66y28heyp20yh0pv5spgssdpv92c6lthq9qyyssqeqwchz0uqfn0f4yyq2r3dk0nukuadjlyk3kr549h2kxqxn6g9s69ae0ycculne3tyfq6424dse47a750ylwggdaqz68jjz06dug3xpspt22zjq getbalance err [ 503, 'PaymentPathfindingFailedToFindPossibleRoute' ] ^C

Here's the lncli part

xxx scripts ₿ lncli payinvoice lnbc957470n1p34dk0app5sfhm44nsc70s3hflh9nstvqy6nd8m9qdqx0yjkp2avaq50j297jqdpsvfskcctwvdjjqumdwv68xct5wvs8gmeqwpazq6twwehkjcm9cqzpgxqyz5vqsp5hz64aumq5pctf2d7lge66y28heyp20yh0pv5spgssdpv92c6lthq9qyyssqeqwchz0uqfn0f4yyq2r3dk0nukuadjlyk3kr549h2kxqxn6g9s69ae0ycculne3tyfq6424dse47a750ylwggdaqz68jjz06dug3xpspt22zjq Payment hash: 826fbad670c79f08dd3fb96705b004d4da7d940d019e49582aeb3a0a3e4a2fa4 Description: xxx Amount (in satoshis): 95747 Fee limit (in satoshis): 4787 Destination: 02f9169d3c0ee17e364559cbad9711eab4dc71d4ef425941bc0be44deb2e4ddb57 Confirm payment (yes/no): yes +------------+--------------+--------------+--------------+--------+----------+--------------------+-------------------------------------------------------------------------+ | HTLC_STATE | ATTEMPT_TIME | RESOLVE_TIME | RECEIVER_AMT | FEE | TIMELOCK | CHAN_OUT | ROUTE | +------------+--------------+--------------+--------------+--------+----------+--------------------+-------------------------------------------------------------------------+ +------------+--------------+--------------+--------------+--------+----------+--------------------+-------------------------------------------------------------------------+ | HTLC_STATE | ATTEMPT_TIME | RESOLVE_TIME | RECEIVER_AMT | FEE | TIMELOCK | CHAN_OUT | ROUTE | +------------+--------------+--------------+--------------+--------+----------+--------------------+-------------------------------------------------------------------------+ +------------+--------------+--------------+--------------+--------+----------+--------------------+-------------------------------------------------------------------------+ | HTLC_STATE | ATTEMPT_TIME | RESOLVE_TIME | RECEIVER_AMT | FEE | TIMELOCK | CHAN_OUT | ROUTE | +------------+--------------+--------------+--------------+--------+----------+--------------------+-------------------------------------------------------------------------+ | SUCCEEDED | 0.026 | 3.535 | 47873.5 | 0 | 760175 | 835007613130637312 | 02f9169d3c0ee17e3645 | | SUCCEEDED | 0.066 | 3.387 | 47873.5 | 40.111 | 760295 | 834037843818446848 | LNBIG.com [lnd-27]->bfx-lnd0->WalletOfSatoshi.com->02f9169d3c0ee17e3645 | +------------+--------------+--------------+--------------+--------+----------+--------------------+-------------------------------------------------------------------------+ Amount + fee: 95747 + 40.111 sat Payment hash: 826fbad670c79f08dd3fb96705b004d4da7d940d019e49582aeb3a0a3e4a2fa4 Payment status: SUCCEEDED, preimage: dbf2301550a42ffceb4417a2d0946a181c88145885ded35e6d4b3a46f8c05f3b

pseudozach avatar Oct 24 '22 19:10 pseudozach

Interesting, i'm not sure what is going wrong actually so I will have to think about it and play around with it

alexbosworth avatar Oct 24 '22 19:10 alexbosworth

If you can repro it locally I would also see if changing max_paths helps at all?

alexbosworth avatar Oct 24 '22 19:10 alexbosworth

I've added these max_fee: 100, max_paths: 5 and it seems to have resolved it. I'm confused why max_paths is needed? and does lncli by default use it?

pseudozach avatar Oct 26 '22 18:10 pseudozach

Aha very interesting ok, i wonder if max paths alone would have resolved it

The default in ln-service for max paths is 1

alexbosworth avatar Oct 26 '22 18:10 alexbosworth