-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tapchannel: enforce strict forwarding for asset invoices #1144
base: main
Are you sure you want to change the base?
Conversation
Pull Request Test Coverage Report for Build 11385013038Details
💛 - Coveralls |
Before assigning reviewers, tests will need to be added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice approach! And great to have a unit test. Though I wonder what would actually happen on the sender and receiver side with this change? My assumption is that things would just time out (rather than rejecting the HTLC).
So I think we should also have an integration test for this.
sellQuote, isSell := acceptedSellQuotes[rfqmsg.SerialisedScid(scid)] | ||
|
||
switch { | ||
case isBuy: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder: Shouldn't an invoice always relate to a buy order only? Even in a direct peer payment, when I create an invoice, there should be a buy quote for it.
tapchannel/aux_invoice_manager.go
Outdated
// | ||
// TODO(george): Strict-forwarding could be configurable? | ||
if s.isAssetInvoice(req.Invoice) { | ||
resp.AmtPaid = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, interesting approach. What does actually happen with this though? Did you try this in an itest?
I'm assuming the payment will just time out if it's MPP (since the sender is waiting for settle and the receiver is waiting for more shards that pay toward the invoice since none of them actually held any value yet).
Or does the zero amount here lead to a direct error that is propagated back to the sender?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're intercepting the invoice at the htlc level, which means that for mpp payments we'll intercept N times for N shards. Within the context of intercepting a single htlc we can only signal what the effective value of that single htlc is (i.e we can only ignore the "value contribution")
In the payment context we'll see a timeout, as we're still waiting for other htlcs that may sum up to the expected value
6f724f2
to
950d0ae
Compare
An itest that covers this behavior has been added in a litd PR |
This PR adds a few extra steps to the
AuxInvoiceManager
before it settles an invoice. Previously we wouldn't check that we received an asset HTLC for an asset invoice, leading to some undesired behavior.With these changes we enforce that if the invoice corresponds to an asset invoice then we only settle it if we received assets.
Todo:
Closes #1008