• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

bitcoindevkit / bdk / 22990083705
80%
master: 78%

Build:
Build:
LAST BUILD BRANCH: docs/txupdate-temporal-context
DEFAULT BRANCH: master
Ran 12 Mar 2026 06:51AM UTC
Jobs 1
Files 27
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

12 Mar 2026 06:49AM UTC coverage: 79.661% (-0.04%) from 79.705%
22990083705

push

github

evanlinjin
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

New Missed Lines in Diff

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
Jobs
ID Job ID Ran Files Coverage
1 22990083705.1 12 Mar 2026 06:51AM UTC 27
79.66
GitHub Action Run
Source Files on build 22990083705
  • Tree
  • List 27
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • 3ef748f5 on github
  • Prev Build on release/chain-0.23.x (#22973504837)
  • Next Build on release/chain-0.23.x (#22990122469)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc