LND allows creating invoice with negative amount:
lncli addinvoice --memo "broken" --value "-10"
Which causes lncli listinvoices to fail with:
"error": "2 UNKNOWN: unable to decode payment request: amount 18446744073709451616 pBTC not expressible in msat"
Same goes with lncli decodepayreq:
$ lncli decodepayreq lnbc18446744073709451616p1pdxytcypp5tupcauu6qggpsad2n9s48ntkgewztp7vjylw7954933r27pslfmqdq2vfex76m9dccqzysh3m06h5ewty3a05f5ezn790um5fgzlf2qv0kqgrlkueth7yjhsdnam3rd9p5nexyz3qy7vtaadufdawahgx5eksjhl8200kggw74dtspmakq02
[lncli] rpc error: code = Unknown desc = amount 18446744073709451616 pBTC not expressible in msat
Solution: implement checking in addinvoice to prevent generating invoice with negative amount.
Broken LND can be fixed by removing malformed invoice from channel.db manually.
Nice catch! I'll start working on a fix for this.
Most helpful comment
Nice catch! I'll start working on a fix for this.