lnd icon indicating copy to clipboard operation
lnd copied to clipboard

addinvoice --private doesn't add hop hints if no amount is provided

Open petertodd opened this issue 3 years ago • 1 comments

Background

lncli addinvoice --private returns an invoice without hop hints; if an amount is provided the --private option works as expected.

Your environment

  • lnd version 0.15.0-beta commit=v0.15.0-beta

Expected behaviour

Either provide hop hints. Or if that's not technologically possible, return an error.

petertodd avatar Jul 15 '22 12:07 petertodd

Capturing root-cause analysis comments

https://github.com/lightningnetwork/lnd/blob/f7b74426808c0305eb594bb0addbf4c1c035d9cd/lnrpc/invoicesrpc/addinvoice.go#L695

Initial assessment:

lnd would use the amt to decide what to place in the hop hint (most MPP), but maybe we had a regression there [...] prob a 0 >= 0 case, which causes things to break early [...] we check to see if we have enough: the amount is zero and we have zero added in hop hints so it's like ok

e.g. Due to the amount being 0 sufficientHints prematurely returns true before lnd has assembled enough routing hints

dstadulis avatar Jul 15 '22 23:07 dstadulis