bitcoindevkit / bitcoindevkit/bdk_wallet

TxGraph::balance's API is too complicated

Open
#115 2 comments 0 reactions 0 assignees View on GitHub
api
Dominant language
Rust
Stars
59
Forks
105
Avg merge
10d 9h
Merged PRs (30d)
1

Description

```rust
pub fn try_balance(
&self,
chain: &C,
chain_tip: BlockId,
outpoints: impl IntoIterator,
mut trust_predicate: impl FnMut(&OI, &Script) -> bool,
) -> Result {
```

`OI` is unnecessary. The caller passes it to us and then we query it. It can just be:

```rust
pub fn try_balance(
&self,
chain: &C,
chain_tip: BlockId,
outpoints: impl IntoIterator,
mut trust_predicate: impl FnMut(&OutPoint, &Script) -> bool,
) -> Result {
```

If the caller wants to know the value of `OI` in trust predicate it can just look it up itself via the `OutPoint`.

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.