Conversation
…le event Previously, `Bolt11Payment::claim_for_id`'s `claimable_amount_msat` check compared the caller-supplied argument against `details.amount_msat`, which for any payment received since the payment-ID refactor in v0.8-development is itself derived from the same triggering event. This made the check ineffective for well-behaved callers and silently permissive of mismatched arguments across concurrent manual claims. Store the amount reported by the triggering `PaymentClaimable` event on `PaymentKind::Bolt11` and require `claim_for_id` callers to echo it back exactly. The historic underpayment guard (net of any JIT-channel-opening LSP fee) is preserved for payments serialized before the v0.8 refactor, where `amount_msat` still reflects the originally requested invoice amount. AI tooling (Claude Code) was used to help implement and test this change.
|
I've assigned @tnull as a reviewer! |
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.
Summary
Fix
claim_for_idamount validation by validating the requested claim amount against the amount observed in the correspondingPaymentClaimableevent.Previously, the claim flow could validate the amount using stored payment information that did not necessarily represent the amount that was actually claimable. This change makes the validation consistent with the observed
PaymentClaimableevent.Changes
claim_for_idagainst the amount from the observedPaymentClaimableevent.CHANGELOG.md.Testing
Added integration test coverage for the
claim_for_idamount validation flow, including validation against the amount reported by thePaymentClaimableevent.Files Changed
src/event.rssrc/payment/bolt11.rssrc/payment/store.rssrc/wallet/mod.rstests/integration_tests_rust.rsCHANGELOG.mdCloses #1091