Skip to content

fixed CanonicalReason::Assumed to check for direct anchor when no descendant exists#2110

Closed
AayushGupta56 wants to merge 2 commits intobitcoindevkit:masterfrom
AayushGupta56:ChainPosition
Closed

fixed CanonicalReason::Assumed to check for direct anchor when no descendant exists#2110
AayushGupta56 wants to merge 2 commits intobitcoindevkit:masterfrom
AayushGupta56:ChainPosition

Conversation

@AayushGupta56
Copy link

fixes #2088

Summary :- When a transaction is both in assume_canonical and has a direct anchor, it was incorrectly returned as ChainPosition::Unconfirmed. This fix adds a check for a direct anchor in the None descendant case, returning ChainPosition::Confirmed when an anchor exists.

@AayushGupta56
Copy link
Author

AayushGupta56 commented Feb 1, 2026

@ValuedMammal can you please review this ?
Should I also add the testcase you mentioned in the issue?
Although the issue was already assigned to someone else but the was no activity on this issue since 2 weeks, so I gave it a try 😅.

@AayushGupta56 AayushGupta56 changed the title fixed CanonicalReason::Assumed to check for direct anchor when no des… fixed CanonicalReason::Assumed to check for direct anchor when no descendant exists Feb 1, 2026
@evanlinjin
Copy link
Member

@AayushGupta56 thanks for the PR. Please add some tests!

@AayushGupta56
Copy link
Author

@AayushGupta56 thanks for the PR. Please add some tests!

added a test in test_canonical_view.rs

@evanlinjin evanlinjin changed the base branch from master to release/chain-0.23.x March 11, 2026 14:02
@evanlinjin evanlinjin changed the base branch from release/chain-0.23.x to master March 11, 2026 14:03
@evanlinjin
Copy link
Member

@AayushGupta56 Thanks for working on this!

Therefore I will close this PR. I've added you as a co-author of #2150 - let's continue the conversation there.

@evanlinjin evanlinjin closed this Mar 11, 2026
evanlinjin added a commit that referenced this pull request Mar 12, 2026
…confirmed

43850b5 fix(chain): Tx assumed to be canonical will not be forced unconfimred (志宇)

Pull request description:

  ### Description

  Fixes #2088
  Depends on #2148
  Backport of #2110

  ### Changelog notice

  ```md
  Fixed:
  - Previously, assumed-canonical transactions always became unconfirmed even though the transaction may be anchored in the best chain.
  ```

  ### Checklists

  #### All Submissions:

  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)

  #### New Features:

  * [x] I've added tests for the new feature
  * [x] I've added docs for the new feature

  #### Bugfixes:

  * [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:
  luisschwab:
    ACK 43850b5
  notmandatory:
    ACK 43850b5

Tree-SHA512: 72fa42111a470e4ab52b92213b54d5f6a1521e4994258a41764b18c141fcbc47d4ff58d9e5cdb5cd4dfae151e80e26b64eefc8e735e6c71768e114cefcc3ef8c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

CanonicalReason::Assumed should map to ChainPosition::Confirmed if a direct anchor exists

2 participants