ITADN

`direct_conflicts` should guarantee ordering with most recent conflict last

#2112OpenCamillarhi 创建于 2026-02-03
C
Camillarhicommented
**Describe the enhancement** The `TxGraph::direct_conflicts()` method returns a `Vec<(usize, Txid)>` of conflicting transactions, but there's currently no guaranteed ordering. For downstream libraries like [bdk-wallet](https://github.com/bitcoindevkit/bdk_wallet) that need to track transaction replacements (RBF, double-spends), it would be helpful if the ordering was guaranteed such that the last entry is always the most recent/canonical transaction that remains in the mempool. **Use case** When generating wallet events for replaced transactions in bdk-wallet, we need to identify which conflicting transaction actually replaced the original one. I'm currently using bdk-wallet in ldk-node and consuming these events, but without guaranteed ordering from `direct_conflicts()`, there's no reliable way to determine which conflict is the canonical replacement. **Impact** - [x] Blocking production usage - [ ] Nice-to-have / UX improvement - [ ] Developer experience / maintainability **Are you using BDK in a production project?** - [x] Yes - [ ] No - [ ] Not yet, but planning to **Which backend(s) are relevant (if any)?** - [ ] Electrum - [ ] Esplora - [ ] Bitcoin Core RPC - [x] None / not backend-related (e.g. `bdk_chain`, `bdk_core`) - [ ] Other (please specify): `____` **Project or organization (optional)** <!-- e.g. BitKey, LDK, personal wallet project, etc. --> **Additional context** This came up while implementing wallet events (specifically TxReplaced events) in bdk-wallet. Related PR: https://github.com/lightningdevkit/ldk-node/pull/628
1 条评论