lightninglabs / taproot-assets

A layer 1 daemon, for the Taproot Assets Protocol specification, written in Go (golang)
MIT License
458 stars 110 forks source link

tapchannel/[feature]: update `AuxInvoiceManager` to enforce strict forwarding for invoices #1008

Open Roasbeef opened 2 months ago

Roasbeef commented 2 months ago

Is your feature request related to a problem? Please describe.

Today if a user has one private asset channel, and a public Bitcoin channel, then due to fees or jitter otherwise, a sender may actually pay over the BTC channel. From the receivers side, the invoice has been paid, but potentially not in the desired currency.

Describe the solution you'd like

Today we'll based the custom invoice hook based on if an HTLC has custom data or not: https://github.com/lightninglabs/taproot-assets/blob/fca9d11f027cdb5b81a36c4a8999c6b010ac0c44/tapchannel/aux_invoice_manager.go#L121-L124.

We should also do the opposite check: if we get an HTLC over a channel, for an invoice with custom data, but the HTLC has no custom data, then we reject.

Describe alternatives you've considered

Make the behavior above optional, all a lax receive mode (any currency works).

dstadulis commented 1 month ago

[should] reject the invoice if it doesn't come across the asset chan we expect logic would be in the invoice acceptor

Handles the case where an external node attempts to route payment to node ID rather than over a discrete set of SCIDs