|
Ran
|
Jobs
1
|
Files
28
|
Run time
1min
|
Badge
README BADGES
|
push
github
Merge bitcoindevkit/bdk#2074: Fix `ChainPosition` ordering 1cc7d606a fix(chain): correct unconfirmed `ChainPosition` `last_seen` tiebreaker (志宇) 184db01a3 fix(chain): correct ChainPosition ordering for wallet transaction display (志宇) Pull request description: ## Description This PR fixes incorrect ordering of `ChainPosition` that affected how wallet transactions are displayed. Previously, unconfirmed transactions that were never seen in the mempool would incorrectly appear before transactions with mempool timestamps due to the derived `Ord` implementation treating `None` as less than `Some(_)`. ### Problem The derived `Ord` implementation for `ChainPosition::Unconfirmed` caused incorrect transaction ordering: - `Unconfirmed { first_seen: None, last_seen: None }` (never in mempool) - Would appear **before** `Unconfirmed { first_seen: Some(10), last_seen: Some(10) }` (seen in mempool) This resulted in a confusing wallet display where transactions never broadcast would appear before pending mempool transactions. ### Solution Implemented manual `Ord` and `PartialOrd` traits for `ChainPosition` with the correct ordering: 1. **Confirmed transactions** (earliest first by block height) 2. **Unconfirmed transactions seen in mempool** (ordered by `first_seen`) 3. **Unconfirmed transactions never seen** (these come last) Additional ordering rules: - At the same confirmation height, transitive confirmations come before direct confirmations (as they may actually be confirmed earlier) - Tie-breaking uses transaction IDs for deterministic ordering ## Changelog notice ### Fixed - Fixed `ChainPosition` ordering so unconfirmed transactions never seen in mempool appear last instead of first ### Changed - `ChainPosition`, `CanonicalTx`, and `FullTxOut` now require `A: Ord` for their `Ord` implementations - Simplified `FullTxOut` ordering to only use essen... (continued)
378 of 512 branches covered (73.83%)
Branch coverage included in aggregate %.
27 of 46 new or added lines in 2 files covered. (58.7%)
4236 of 5334 relevant lines covered (79.42%)
3233.46 hits per line
| Lines | Coverage | ∆ | File |
|---|---|---|---|
| 8 |
87.45 |
-2.93% | crates/chain/src/canonical_view.rs |
| 11 |
62.73 |
4.39% | crates/chain/src/chain_data.rs |
| ID | Job ID | Ran | Files | Coverage | |
|---|---|---|---|---|---|
| 1 | 21207897136.1 | 28 |
78.93 |
GitHub Action Run |
| Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line | Branch Hits | Branch Misses |
|---|