You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge #2027: feat(chain): add new list_ordered_canonical_txs method
12c1076 feat(chain): introduce new `list_ordered_canonical_txs` (Leonardo Lima)
f34117b test(chain): add `test_list_ordered_canonical_txs` (Leonardo Lima)
a201be0 chore(test): rename `txid_to_name` to proper `tx_name_to_txid` (Leonardo Lima)
6cf720e chore(docs): fix typo in docs (Leonardo Lima)
Pull request description:
### Description
It introduces a new method for topological ordering canonical transactions, `list_ordered_canonical_txs`. It now ensures the dependency-based transaction processing, guaranteeing that parent transactions always appears before their children transaction.
The existing `list_canonical_txs` and `try_list_canonical_txs` methods have been deprecated in favor of the new ordered version.
### Notes to the reviewers
"[...] For those reviewing, and wondering why we don't have a fallible try version of this method, it's because we don't have a fallible ChainOracle implementation - we will get rid of ChainOracle trait soon anyway."
This PR is intended for a point release so that bdk_wallet 2.x users can get a topologically sorted list of transactions (we need a point release on bdk_wallet 2.x as well).
It might be useful to take a look at the new test scenarios that I've added, it shows some specific scenarios where the current implementation and output of `canonical_txs` didn't output the transactions in topological order.
Let me know if you think the TopologicalIter algorithm and/or API could be improved.
### Changelog notice
```
#### Added
- New `list_ordered_canonical_txs` method to `TxGraph` that returns canonical transactions in topological order, ensuring parent transactions always appear before their children
#### Deprecated
- `list_canonical_txs` method - use `list_ordered_canonical_txs` instead for guaranteed topological ordering
- `try_list_canonical_txs` method - use `list_ordered_canonical_txs` instead for guaranteed topological ordering
```
### 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
ACKs for top commit:
ValuedMammal:
ACK 12c1076
Tree-SHA512: 73c8cc40e6b77844af52ddc1a788cf1190357e08f487f443ab492881e50ed4343598e2607f542e7d9b69615cd102f29ec3bda5942753186860d919433b1d62dd
0 commit comments