bitcoindevkit / bitcoindevkit/bdk

`direct_conflicts` should guarantee ordering with most recent conflict last

Open
#2,112 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.1k
Forks
483
Avg merge
20d 3h
Merged PRs (30d)
3

Description

**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)**

**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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.