lightningnetwork / lnd

Lightning Network Daemon ⚡️
MIT License
7.63k stars 2.07k forks source link

[Feature Request] mark invoice "settled" when fallback address receives payment #2850

Open brandoncurtis opened 5 years ago

brandoncurtis commented 5 years ago

Background

Fallback addresses can be added to BOLT-11 invoices so that a payment can be made on-chain if an off-chain payment is not possible or desirable. However, an invoice's state is not updated to reflect payment is the invoice recipient pays to this fallback address.

Your environment

Steps to reproduce

  1. lncli addinvoice --fallback_addr $FALLBACKADDR --amt $AMT
  2. Pay $AMT to $FALLBACKADDR
  3. inspect the invoice with lncli listinvoices. The invoice settled field will be false.

Expected behaviour

If an invoice recipient uses the fallback address to send an on-chain payment of the correct size, the invoice in which this fallback address was included will be marked as settled.

Additional Considerations

It's possible an invoice generator could reuse a fallback address within multiple invoices for a payment of the same size, which could make it ambiguous what should be marked as paid if a payment is made to that address.

LND could prevent reuse of fallback addresses within multiple invoices, or at least reuse within invoices for a payment of the same size, to remove this ambiguity.

LND could prevent fallback address reuse in any 0-amt invoices.

ccdle12 commented 5 years ago

Seems like no one has picked this one up yet, so would be happy to give this one a try.

sistemd commented 2 years ago

Are you sure this is the correct approach? I see two potential issues:

  1. With the current behavior (i.e. not settling the invoices), it's possible to pay to the fallback address and pay the invoice afterward. With this change, I believe LND would have to deny paying to invoices after the fallback address was used, which is technically a breaking change for the clients.
  2. The new proposed behavior (i.e. settling invoices) might not be semantically correct. BOLT11 never specifies that payments to the fallback address should invalidate the invoice, and as far as I've been able to tell, none of the BOLTs ever say this.

For these reasons, I don't feel like this feature should be implemented. Maybe we should close it.

CC @bjarnemagnussen @carlaKC @Roasbeef @guggero