lnpeer: fix todos in maybe_fulfill_htlc (enforce cltv, invoice expiry and reject duplicate payments)#10193
Closed
f321x wants to merge 8 commits intospesmilo:masterfrom
Closed
lnpeer: fix todos in maybe_fulfill_htlc (enforce cltv, invoice expiry and reject duplicate payments)#10193f321x wants to merge 8 commits intospesmilo:masterfrom
f321x wants to merge 8 commits intospesmilo:masterfrom
Conversation
762ff95 to
1b9017f
Compare
Add `test_reject_invalid_min_final_cltv_delta` which is supposed to test that the peer rejects incoming htlcs with final cltv delta differing from what has been requested in the lightning invoice.
Adds the min_final_cltv_delta value to PaymentInfo so that it is possible to verify it later when receiving the htlcs in lnpeer. Currently the min_final_cltv_delta which was used in get_bolt11_invoice for the lightning invoice was not persisted (except maybe through the invoice in a Request object), so it was not possible to verify it when receiving htlcs. get_bolt11_invoice is now dependent on PaymentInfo being available, so PaymentInfo has to be created first. This is done to prevent creating a bolt11 invoice with different min_final_cltv_delta than the value stored in PaymentInfo.
Version 60 to 61, converts the PaymentInfo tuple into the PaymentInfo dataclass.
This ensures that invoices can only be created if PaymentInfo has been created first. It also ensures that the values in PaymentInfo are similar to the values shared in the invoice.
Enforces the min_final_cltv_delta and expiry the receiver of the payment has requested from the sender through the lightning invoice.
Test that lnpeer is rejecting incoming htlcs for invoices that are already expired.
Test that lnpeer rejects incoming htlcs for payments that have already been paid so invoices cannot be paid twice.
Reject new incoming htlcs for requests that have already been paid before.
1b9017f to
3dad647
Compare
Member
Author
|
Closed in favor of #10230 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes some todos in
LNPeer.maybe_fulfill_htlc().min_final_cltv_deltarequested in the lightning invoice for incoming htlcs that will not get directly settled, this is relevant for hold invoices.This PR will do a wallet db upgrade!