Repository navigation
feat(key-wallet-manager)!: give TransactionsSwept the winner's block - #1507
Conversation
`TransactionsSwept` gives a mined winner's height only. A consumer that keeps the sweep as evidence must later check that the winner's block is still on the active chain, and the height alone cannot say which branch mined it: a header lookup made after the event may already answer for a replacement branch, for example when the consumer misses a `ChainTruncated` while its event monitor restarts. `winner_mined_height: Option<CoreBlockHeight>` becomes `winner_block: Option<BlockInfo>`: the winner's height, block hash and position as the processed block gives them, and `None` for an InstantSend-locked winner as before. `Display` prints `height@hash`. BREAKING CHANGE: `WalletEvent::TransactionsSwept::winner_mined_height` is replaced by `winner_block`; use `winner_block.map(|b| b.height())` for the height. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Pre-review record for head An independent automated code review read the first version, then re-read this exact head. Verdict: approved with suggestions. Fixed before this head:
Left as is:
🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #1507 +/- ##
=======================================
Coverage 87.53% 87.53%
=======================================
Files 270 270
Lines 71309 71313 +4
=======================================
+ Hits 62421 62427 +6
+ Misses 8888 8886 -2
|
…ture Merges fix/pending-spend-authorization at 920f103 (built on #1416 at f134961). Conflict resolutions: - key-wallet-manager events.rs and process_block.rs: R9's wording for the drop trigger combined with #1507's `winner_block` field; R9's event test reads `winner_block: None`. - key-wallet helpers.rs: #1518/#1519's dismissal and give-back helpers and R9's authorization helpers are kept side by side; imports are merged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Bots are done — your move: post |
|
Bots are done — your move: post |
|
Bots are done — your move: post |
|
✅ Review complete in 6m 55s Planner (5s) Review (security · full): 10 findings Judge (2m 26s) Posted: 1 finding Review metadataConfig:
Account limits:
Judge decisions:
Timing:
Last reviewed
|
There was a problem hiding this comment.
Create an issue for this to track it for later. Manki approves once every warning is handled.
About this review
- Reviewed
6939476, round 1 - 97 changed lines read in 6m 55s
- Found by
claude-opus-5-5andgpt-6.2-sol, judged byclaude-opus-5-5 - Tokens: 4.4M in (3.5M from cache) · 48k out · about $5.11 at API prices
- Runner: self-hosted · started after 7m 37s · peak memory 2.7 GiB of 30.0 GiB
- How Manki reviews
There was a problem hiding this comment.
✅ Approved. All blocking threads are resolved, and no warning thread holds the approval.
What this does: A sweep event used to report only the height of the block whose transaction beat the removed spends. It now reports that block's hash, height and the winner's position in it.
What to test
The review model wrote these steps. Check what a step runs before you follow it.
Setup: A wallet manager with a funded wallet holding two coins from one funding transaction, and a subscriber on subscribe_events.
- Record a mempool spend of both coins, then process a block whose second transaction spends only the first coin. Expect one
TransactionsSweptwithwinner_blockset to that block's hash and height andposition()equal toSome(1). - In the same scenario, check
released_outpoints. Expect only the second coin. - Format that event with
Display. Expect the textwinner_block=<height>@<hash>. - Instead of a block, deliver the winning spend from the mempool with an InstantSend lock. Expect
TransactionsSweptwithwinner_blockequal toNoneandDisplayshowingwinner_block=None. - Process the same winner in two blocks with different hashes at the same height. Expect each sweep to carry its own block hash.
|
/self-reviewed 6939476 |
|
Ready for review — |
…run 46082554971)
WalletEvent::TransactionsSweptreports a mined winner by height only. A consumer that keeps the sweep as evidence has to check later that the winner's block is still on the active chain, and a height can't say which branch mined it. A header lookup made after the event may already answer for a replacement branch, for example when the consumer misses aChainTruncatedwhile its event monitor restarts.winner_mined_height: Option<CoreBlockHeight>becomeswinner_block: Option<BlockInfo>. It holds the winner's height, block hash and position as the processed block gives them, and staysNonefor an InstantSend-locked winner.Displayprintsheight@hash.Breaking: callers that read
winner_mined_heightusewinner_block.map(|b| b.height()).Tests:
test_block_winner_emits_swept_event_naming_the_released_outpointsnow places the winner at index 1 of its block and checks its height, hash and position.transactions_swept_display_reports_the_winners_finality_contextcovers both display forms.cargo fmt --all --check,contrib/run_clippy.py,cargo docwith-D warnings, and the CIwalletgroup pass.🤖 Generated with Claude Code
PR Hygiene ·
6939476key-wallet-manager(key-wallet-manager/src/event_tests.rs,key-wallet-manager/src/events.rs,key-wallet-manager/src/process_block.rs) — QuantumExplorer or ZocoLini or xdustinfaceWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.