bitcoindevkit / bitcoindevkit/bdk

Consider `Balance::unknown_pending` for outputs of unknown origin

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

Description

From #2246, thanks @evanlinjin.

**Describe the enhancement**

Whether `Trust::Unknown` should have `unknown_pending` as `Balance` field instead of being folded into `untrusted_pending`.

**Use case**

The `does_taint` predicate in `CanonicalView::classify_outpoints` can't distinguish "known foreign" from "unknown origin" for an incoming outpoint, both collapse into `Trust::Untrusted`/`untrusted_pending` today. A separate `unknown_pending` classification would let callers that can tell the difference surface it.

Open questions if revisited:
- Is `does_taint: FnMut(&CanonicalTx) -> Option` worth the signature change for indexers that track unowned outputs?
- If so, does `Trust::Unknown` deserve `Balance::unknown_pending`, or is folding it into `untrusted_pending` (current behavior) good enough?

**Impact**
- [ ] Blocking production usage
- [ ] Nice-to-have / UX improvement
- [x] Developer experience / maintainability

**Are you using BDK in a production project?**
- [ ] Yes
- [ ] No
- [x] 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): `____`

Contributor guide

Open the contributing guide

Research direction

Review issue #2246, then trace CanonicalView::classify_outpoints, its does_taint predicate, and the Trust and Balance types. Determine whether unknown-origin outputs need a distinct classification and whether changing the predicate signature is justified for indexers; done means reaching and documenting a decision on these open questions.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.