Lnd: Invoice with negative amount breaks LND

Created on 19 Jan 2018  路  1Comment  路  Source: lightningnetwork/lnd

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.

bug payments

Most helpful comment

Nice catch! I'll start working on a fix for this.

>All comments

Nice catch! I'll start working on a fix for this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

qubenix picture qubenix  路  3Comments

MrManPew picture MrManPew  路  3Comments

alexbosworth picture alexbosworth  路  3Comments

alec-djinn picture alec-djinn  路  3Comments

hxsquid picture hxsquid  路  3Comments