|
Ran
|
Jobs
1
|
Files
27
|
Run time
1min
|
Badge
README BADGES
|
push
github
Merge bitcoindevkit/bdk#2146: `chain 0.23.x`: Fix `ChainPosition` ordering aff800d86 fix(chain): correct unconfirmed `ChainPosition` `last_seen` tiebreaker (志宇) 9d2dedcd5 fix(chain): correct ChainPosition ordering for wallet transaction display (志宇) Pull request description: ## Description Back-ported from #2074 Depends on #2148 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 ```md ### 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` ... (continued)
385 of 522 branches covered (73.75%)
Branch coverage included in aggregate %.
34 of 46 new or added lines in 2 files covered. (73.91%)
4358 of 5432 relevant lines covered (80.23%)
2234.74 hits per line
| Lines | Coverage | ∆ | File |
|---|---|---|---|
| 3 |
85.58 |
-0.16% | crates/chain/src/tx_graph.rs |
| 9 |
64.55 |
6.21% | crates/chain/src/chain_data.rs |
| ID | Job ID | Ran | Files | Coverage | |
|---|---|---|---|---|---|
| 1 | 22990083705.1 | 27 |
79.66 |
GitHub Action Run |
| Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line | Branch Hits | Branch Misses |
|---|