Skip to content

Is there a way to run coin selection on a subset of coins? #1080

Answered by notmandatory
icota asked this question in Q&A
Discussion options

You must be logged in to vote

The TxBuilder allows you to specify which UTXOs must NOT be used in coin-selection. It's a bit awkward but if you give it all the UTXOs but the user selected subset then coin-selection will only use your selected subset. The assumption is that you'll usually only have a few UTXOs (such as from dusting attacks) that you want to exclude from coin-selection and the rest are fair game.

https://docs.rs/bdk/latest/bdk/wallet/tx_builder/struct.TxBuilder.html#method.add_unspendable

Going forward for new BDK APIs this sounds like a good feature to add to let you specify your allowed subset directly. Would this make sense for TxBuilder functions to specify "allowed" UTXOs?

/// Add a list of outpoin…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by icota
Comment options

You must be logged in to vote
1 reply
@notmandatory
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants