Skip to content

docs: document TxBuilder default coin selection algorithm#512

Open
ANAMASGARD wants to merge 1 commit into
bitcoindevkit:masterfrom
ANAMASGARD:docs/txbuilder-document-default-coin-selection
Open

docs: document TxBuilder default coin selection algorithm#512
ANAMASGARD wants to merge 1 commit into
bitcoindevkit:masterfrom
ANAMASGARD:docs/txbuilder-document-default-coin-selection

Conversation

@ANAMASGARD

Copy link
Copy Markdown

Closes #508

Summary

Documents the default coin selection algorithm used by TxBuilder when .coin_selection() is not called: BranchAndBoundCoinSelection<SingleRandomDraw>. Developers previously had to read source to discover this. The default is now
explained at every natural entry point.

Changes

  • TxBuilder struct docs: new "Default Coin Selection" section describing BnB behavior (exact-match search to avoid change) and SingleRandomDraw fallback
  • TxBuilder::coin_selection(): names the default algorithm being overridden
  • DefaultCoinSelectionAlgorithm: expanded type alias docs (BnB strategy,
    fallback, P2WPKH change size assumption)
  • coin_selection module docs: names the default algorithm in the intro
  • Wallet::build_tx() and Wallet::build_fee_bump(): note that default
    coin selection applies unless overridden
    No logic changes. Doc-only PR.

Test plan

  • RUSTDOCFLAGS="-D warnings" cargo doc --no-deps — no broken links
  • cargo test --doc — all doc tests pass
  • cargo fmt --all -- --check — formatting clean

Closes bitcoindevkit#508

Make the default BranchAndBoundCoinSelection<SingleRandomDraw>
algorithm discoverable from TxBuilder, Wallet::build_tx, and the
coin_selection module without reading implementation code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Default coin selection used by TxBuilder is not documented

1 participant