bitcoindevkit / coin-select

Tool to help you select inputs for making bitcoin transactions.
Other
13 stars 7 forks source link

`CoinSelector::run_bnb` should fallback to `select_until_target_met`? #3

Closed evanlinjin closed 9 months ago

evanlinjin commented 11 months ago

@LLFourn commented:

When i was suggesting this method I was thinking that it would fall back to select_until_target_met if it can't find anything. This would mean you don't need this error type -- rather you can just have InsufficientFunds.

Do you think it's worth having run_bnb_with_fallback() that does that?

Also another sneaky request -- if #[cfg(feature = "std")] can you add a method that lets you pass in a std::time::Duration and checks the time passed every 1_000 rounds and stops after the time has been exceeded.

-- https://github.com/bitcoindevkit/bdk/pull/1072/files/d620dc61e809a8c280d623d5275abe8413b4b00a#r1393667785

LLFourn commented 9 months ago

So I saw why you didn't do this: you don't have access to the Target in run_bnb. We can call it a feature that you have to explicitly decide what to do when one algo doesn't find anything :). Closing this for now.