Skip to content

Conversation

Rahamath-unnisa
Copy link

This pull request enhances the CanonicalIter in the chain module to return the full TxNode—which includes Txid, Transaction, and CanonicalReason—instead of just the Txid. This improvement allows better tracking of canonical transactions along with the reason why each transaction is considered canonical.

Additionally, debug logging has been added throughout the canonicalization process. This logging prints transaction IDs as they are processed, which makes it easier to trace the iteration flow and understand how conflicts and ancestor-descendant relationships are resolved.

These changes improve the testability and observability of canonical transaction processing in the BDK library, which is particularly useful when working with transaction graphs that have complex conflicts or multiple anchors.

Notes to Reviewers

The debug logs are temporary and intended to help during development and testing.

This change does not alter the underlying canonicalization logic but provides more detailed output and richer information per transaction.

No existing APIs are broken; only the iterator’s item type has been extended to provide more context.

Copy link
Contributor

@oleonardolima oleonardolima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like the code is really changing the types to return a TxNode, there's no change on it yet.

if !self.is_canonicalized(txid) {
self.mark_canonical(txid, tx, CanonicalReason::assumed());
}
continue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't change the behavior of the canonicalization algorithm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants