Describe the enhancement
TxGraph::walk_ancestors skips the root transaction, it starts directly from the parents of the tx passed in. There is currently no public way to traverse ancestors including the root itself.
Use case
In bitcoindevkit/bdk_wallet@15beb0b5, balance() needs to inspect the inputs of every transaction in a chain, including the root, to determine whether they belong to the wallet. By including the root, the same inspection logic would not be duplicated.
I have a few ideas to discuss:
-
Make TxAncestors::new_include_root public. It already exists as pub(crate), so the change would be minimal. Not sure if there's a reason it was kept internal.
-
Add a wrapper method on TxGraph (e.g. walk_ancestors_include_root), follows the same pattern as walk_ancestors and keeps TxAncestors as an implementation detail.
Impact
- Developer experience / maintainability
Describe the enhancement
TxGraph::walk_ancestors skips the root transaction, it starts directly from the parents of the tx passed in. There is currently no public way to traverse ancestors including the root itself.
Use case
In bitcoindevkit/bdk_wallet@15beb0b5,
balance()needs to inspect the inputs of every transaction in a chain, including the root, to determine whether they belong to the wallet. By including the root, the same inspection logic would not be duplicated.I have a few ideas to discuss:
Make
TxAncestors::new_include_rootpublic. It already exists aspub(crate), so the change would be minimal. Not sure if there's a reason it was kept internal.Add a wrapper method on TxGraph (e.g.
walk_ancestors_include_root), follows the same pattern aswalk_ancestorsand keepsTxAncestorsas an implementation detail.Impact