Skip to content

Drop QuiescentError::with_negotiation_failure_reason#4608

Merged
TheBlueMatt merged 3 commits into
lightningdevkit:mainfrom
jkczyz:2026-05-splice-rbf-fail-event-follow-ups
May 18, 2026
Merged

Drop QuiescentError::with_negotiation_failure_reason#4608
TheBlueMatt merged 3 commits into
lightningdevkit:mainfrom
jkczyz:2026-05-splice-rbf-fail-event-follow-ups

Conversation

@jkczyz
Copy link
Copy Markdown
Contributor

@jkczyz jkczyz commented May 8, 2026

Drops QuiescentError::with_negotiation_failure_reason as a follow-up to #4514. The placeholder Unknown reason it overrode was a footgun — sites that forgot to chain it could leak Unknown into Event::SpliceNegotiationFailed, and the pattern wired splice-specific reason vocabulary into the generic QuiescentAction machinery. Each error-return site in propose_quiescence now picks its reason at construction. funding_contributed's pending-quiescent-action check is also made exhaustive on QuiescentAction, so a future variant produces a compile error there.

Also includes two minor doc clarifications from the #4514 review: the relationship between Event::SpliceNegotiationFailed::contribution and Event::DiscardFunding, and the script_pubkey-only matching in FundingContribution::into_unique_contributions.

@ldk-reviews-bot
Copy link
Copy Markdown

ldk-reviews-bot commented May 8, 2026

👋 Thanks for assigning @TheBlueMatt as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@jkczyz jkczyz requested a review from TheBlueMatt May 8, 2026 17:09
@ldk-claude-review-bot
Copy link
Copy Markdown
Collaborator

ldk-claude-review-bot commented May 8, 2026

I've thoroughly reviewed every hunk in this diff, including reading the surrounding context for the modified functions. My prior review already covered all sections comprehensively.

No issues found.

Comment thread lightning/src/ln/funding.rs Outdated
///
/// Outputs are compared by `script_pubkey` alone (not full `TxOut`), since values may
/// differ between rounds (e.g., a change output adjusted for a new feerate). As a
/// consequence, multiple contribution outputs sharing a `script_pubkey` are all
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noting that this won't be allowed anymore after #4575

Comment thread lightning/src/ln/channel.rs Outdated
// Only the test-only DoNothing action is expected here; production callers must
// short-circuit before reaching this branch.
#[cfg(any(test, fuzzing, feature = "_test_utils"))]
let is_allowed = matches!(action, QuiescentAction::DoNothing);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a huge deal, but why does this need to be allowed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some tests calling maybe_propose_quiescence with it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I meant why do we need to allow another DoNothing after one is already pending? Removing this doesn't seem to cause any test failures, is it a fuzzing thing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah... I may have mistakenly thought quiescence_tests was checking this. But indeed that doesn't seem to be the case.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.47%. Comparing base (71fdc27) to head (f4139db).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/ln/channel.rs 66.66% 10 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4608      +/-   ##
==========================================
+ Coverage   86.44%   86.47%   +0.02%     
==========================================
  Files         159      159              
  Lines      109823   109821       -2     
  Branches   109823   109821       -2     
==========================================
+ Hits        94941    94969      +28     
+ Misses      12340    12315      -25     
+ Partials     2542     2537       -5     
Flag Coverage Δ
fuzzing-fake-hashes 5.17% <0.00%> (+0.10%) ⬆️
fuzzing-real-hashes 22.78% <0.00%> (+<0.01%) ⬆️
tests 86.19% <66.66%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jkczyz jkczyz force-pushed the 2026-05-splice-rbf-fail-event-follow-ups branch from b61f231 to b2b0d43 Compare May 8, 2026 19:13
@jkczyz jkczyz requested a review from wpaulino May 8, 2026 19:14
@ldk-reviews-bot
Copy link
Copy Markdown

🔔 1st Reminder

Hey @TheBlueMatt @wpaulino! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

1 similar comment
@ldk-reviews-bot
Copy link
Copy Markdown

🔔 1st Reminder

Hey @TheBlueMatt @wpaulino! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

TheBlueMatt
TheBlueMatt previously approved these changes May 11, 2026
Copy link
Copy Markdown
Collaborator

@TheBlueMatt TheBlueMatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs rebase :(

@TheBlueMatt TheBlueMatt added this to the 0.3 milestone May 11, 2026
@ldk-reviews-bot
Copy link
Copy Markdown

🔔 2nd Reminder

Hey @wpaulino! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@ldk-reviews-bot
Copy link
Copy Markdown

🔔 3rd Reminder

Hey @wpaulino! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@ldk-reviews-bot
Copy link
Copy Markdown

🔔 4th Reminder

Hey @wpaulino! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

jkczyz and others added 3 commits May 18, 2026 11:27
QuiescentError::FailSplice was built with a placeholder
NegotiationFailureReason::Unknown and expected callers to chain a
with_negotiation_failure_reason builder. Sites that forgot the chain
leaked Unknown into Event::SpliceNegotiationFailed, and the pattern
forced splice-specific reason vocabulary into the generic
QuiescentAction helper.

Each call site in propose_quiescence now picks the reason at
construction. The pending-quiescent-action branch is unreachable, so
it asserts unconditionally; the match retains arms for both action
variants so release builds return a sensible error if the invariant
is violated. abandon_quiescent_action returns SpliceFundingFailed
directly without round-tripping through QuiescentError, since the
reason was always discarded there.

Make funding_contributed's pending-quiescent-action check exhaustive
on QuiescentAction. A future variant produces a compile error here
and at the matching arm in propose_quiescence, forcing the author to
decide how it interacts with funding contribution.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The contribution returned in Event::SpliceNegotiationFailed may include
inputs and outputs already committed to a prior negotiated (but not yet
locked) splice transaction. Those overlapping items are intentionally
omitted from the preceding Event::DiscardFunding to avoid prompting the
user to reclaim UTXOs that are still in use elsewhere. The relationship
was documented on the internal SpliceFundingFailed fields but lost when
they were made private; surface it on the public event field doc.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The function compares outputs by script_pubkey alone, not full TxOut,
so any contribution output sharing a script with an existing output is
filtered regardless of value. This is intentional — a change output's
value may shift between rounds (e.g., for a new feerate) and should
still match. But the consequence isn't obvious: multiple contribution
outputs sharing a script are all filtered together when any existing
output uses that script. Document it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jkczyz jkczyz force-pushed the 2026-05-splice-rbf-fail-event-follow-ups branch from b2b0d43 to f4139db Compare May 18, 2026 16:39
@jkczyz jkczyz requested a review from TheBlueMatt May 18, 2026 16:40
@TheBlueMatt TheBlueMatt merged commit 311a986 into lightningdevkit:main May 18, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants