Skip to content

Commit

Permalink
feat(wallet)!: allow custom fallback algorithm for bnb
Browse files Browse the repository at this point in the history
Signature of `CoinSelectionAlgorithm::coin_select` has been changed to
take in a `&mut RangCore`. This allows us to pass the random number
generator directly to the cs algorithm.

Single random draw is now it's own type `SingleRandomDraw` and impls
`CoinSelectionAlgorithm`.

`BranchAndBoundCoinSelection` now handles it's own fallback algorithm
internally, and a generic type parameter is added to specify the
fallback algorithm.

`coin_selection::Error` is renamed to `InsufficientFunds` and the BnB
error variants are removed. The BnB error variants are no longer needed
since those cases are handled internally by
`BranchAndBoundCoinSelection` (via calling the fallback algorithm).

Add test_bnb_fallback_algorithm test and docs cleanup suggested by @ValuedMammal.
  • Loading branch information
evanlinjin authored and notmandatory committed Sep 10, 2024
1 parent 8760653 commit c18204d
Show file tree
Hide file tree
Showing 4 changed files with 230 additions and 163 deletions.
Loading

0 comments on commit c18204d

Please sign in to comment.