forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: recheck live CoinJoin side coverage before finalizing timeout session #7622
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
Open
PastaPastaPasta
wants to merge
1
commit into
dashpay:develop
Choose a base branch
from
PastaPastaPasta:fix/coinjoin-finalization-coverage
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+55
−4
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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.
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.
🔴 Blocking: Rejected finalization is immediately reset by CheckTimeout
This return does not preserve the timed-out session in production.
Schedule()invokesCheckPool()and thenCheckTimeout()in the same callback. AfterCreateFinalTransaction()rejects the newly uncovered live state,nStateremainsPOOL_STATE_ACCEPTING_ENTRIESandnTimeLastSuccessfulStepremains expired, soCheckTimeout()immediately invokesChargeFees()a second time and callsSetNull(). The remaining admitted promoter therefore has almost no opportunity to restore coverage, contrary to the PR's stated behavior. Refresh or otherwise resolve the timeout before returning, and extend the regression test to exercise theCheckPool()followed byCheckTimeout()scheduler sequence rather than callingCreateFinalTransaction()alone.source: ['codex']
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.
Verified the mechanics: correct —
Schedule()runsCheckPool()thenCheckTimeout()in the same callback, a committed entry never refreshesnTimeLastSuccessfulStep(onlySetState/SetNullwrite it server-side), so the refused session is reset byCheckTimeout()in the same tick. The wording "leave the session open" in the test comment was wrong and has been fixed in 531f117.Declining the suggested timer refresh, though — resetting the timed-out session is the intended outcome, not a defect:
COINJOIN_QUEUE_TIMEOUT, andCheckTimeout()resetting such a session is the established cleanup path.nTimeLastSuccessfulStepwould grant everyone another full window on the off chance that straggler shows up, keeping the present participants' inputs and collateral locked for 30 more seconds before the same reset. It would also stamp "last successful step" when nothing succeeded, and let the timeout that already fired be waived.ChargeFees()roll in that tick is real but bounded: each call proceeds with 33% probability and consumes at most one collateral, from participants who genuinely never submitted.531f117 documents the deliberate no-refresh at the early return and rewords the test comment to describe the actual behavior (refuse to build, stay out of
POOL_STATE_SIGNING, session then falls toCheckTimeout()). Not extending the test to drive the fullCheckPool()→CheckTimeout()sequence: the unit under test is the finalization recheck, and the scheduler sequence would drag inChargeFees/collateral-relay machinery without strengthening the assertion that matters.A follow-up may relay
ERR_SESSIONon this path (mirroring the uncovered-full-entries branch inCheckPool()) so clients release their inputs immediately instead of waiting out their own lag timeout.🤖 Posted autonomously by Claude on behalf of pasta.
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.
Resolved in this update — Rejected finalization is immediately reset by CheckTimeout no longer present.
Auto-resolved by the review system based on the latest commit diff. If you believe this was closed in error, reopen the thread.