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

bitcoindevkit / bdk / 14629963594
79%

Build:
DEFAULT BRANCH: master
Ran 23 Apr 2025 11:26PM UTC
Jobs 1
Files 30
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

23 Apr 2025 11:21PM UTC coverage: 82.432% (+1.0%) from 81.442%
14629963594

push

github

evanlinjin
Merge bitcoindevkit/bdk#1917: Canonicalization should handle transactions that spend from two conflicting transactions

<a class=hub.com/bitcoindevkit/bdk/commit/<a class="double-link" href="https://git"><a class=hub.com/bitcoindevkit/bdk/commit/370497c3a9c361e10c8341cbb07210f026cc3e04">370497c3a fix(chain): Correctly handle txs that double spend themselves (志宇)

Pull request description:

  Fixes #1898

  ### Description

  When we initially created the canonicalization algorithm, we didn't expect callers to insert invalid transactions into the graph. However, user error happens and we should handle it correctly.

  Before this PR, when inserting transactions that double-spend themselves (where two or more different inputs of the transactions conflict), the canonicalization result will have inconsistencies.

  ### Notes to the reviewers

  Logic changes are all contained in `CanonicalIter::mark_canonical`. `mark_canonical` will detect whether the `tx` being passed in double spends itself. If so, we abort and undo all changes made so far.

  There is a slight <2% degradation in performance with this change (except in two cases where there is a performance improvement of ~10%).

  [bench.txt](https://github.com/user-attachments/files/19788730/bench.txt)

  ### Changelog notice

  * Fix canonicalization mess-up when transactions that conflict with itself are inserted.

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

  #### Bugfixes:

  ~~* [ ] This pull request breaks the existing API~~
  * [x] I've added tests to reproduce the issue which are now passing
  * [x] I'm linking the issue being fixed by this PR

ACKs for top commit:
  ValuedMammal:
    ACK 370497c3a9c361e10c8341cbb07210f026cc3e04
  LagginTimes:
    ACK 370497c3a9c361e10c8341cbb07210f026cc3e04

Tree-SHA512: 41b08208b76e4ca065cd0e94d6abbacd3c9

30 of 32 new or added lines in 1 file covered. (93.75%)

5 existing lines in 1 file now uncovered.

5119 of 6210 relevant lines covered (82.43%)

29709.7 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
2
94.74
-0.57% crates/chain/src/canonical_iter.rs

Uncovered Existing Lines

Lines Coverage ∆ File
5
83.57
6.19% crates/chain/src/tx_graph.rs
Jobs
ID Job ID Ran Files Coverage
1 14629963594.1 23 Apr 2025 11:26PM UTC 30
82.43
GitHub Action Run
Source Files on build 14629963594
  • Tree
  • List 30
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 4fe121e7 on github
  • Prev Build on master (#14391029163)
  • Next Build on master (#14768349820)
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