]> Untitled Git - bdk/commitdiff
Merge bitcoindevkit/bdk#557: add OldestFirstCoinSelection
authorAlekos Filini <alekos.filini@gmail.com>
Mon, 25 Apr 2022 14:45:43 +0000 (16:45 +0200)
committerAlekos Filini <alekos.filini@gmail.com>
Mon, 25 Apr 2022 14:46:41 +0000 (16:46 +0200)
6931d0bd1f044bf73c0cb760c0eb0be19aea8de1 add private function select_sorted_utxso to be resued by multiple CoinSelection impl (KaFai Choi)
545beec743412717895d0ba5d32ccd9aac68f4a6 add OldestFirstCoinSelection (KaFai Choi)

Pull request description:

  <!-- You can erase any parts of this template not applicable to your Pull Request. -->

  ### Description
  This PR is to add `OldestFirstCoinSelection`. See this issue for detail https://github.com/bitcoindevkit/bdk/issues/120
  <!-- Describe the purpose of this PR, what's being adding and/or fixed -->

  ### Notes to the reviewers
  Apologize in advance if the quality of this PR is too low.(I am newbie in both bitcoin wallet and rust).

  While this PR seemed very straight-forward to me in the first glance, it's actually a bit more complicated than I thought as it involves calling DB get the blockheight before sorting it.

  The current implementation should be pretty naive but I would like to get some opinion to see if I am heading to a right direction first before working on optimizations like

  ~~1. Avoiding calling DB for optional_utxos if  if the amount from required_utxos are already enough.~~ Probably not worth to do such optimization to keep code simpler?

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

  #### New Features:

  * [x] I've added tests for the new feature
  * [x] I've added docs for the new feature
  * [x] I've updated `CHANGELOG.md`

  #### Bugfixes:

  * [ ] This pull request breaks the existing API
  * [ ] I've added tests to reproduce the issue which are now passing
  * [ ] I'm linking the issue being fixed by this PR

ACKs for top commit:
  afilini:
    ACK 6931d0bd1f044bf73c0cb760c0eb0be19aea8de1

Tree-SHA512: d297bbad847d99cfdd8c6b1450c3777c5d55bc51c7934f287975c4d114a21840d428a75a172bfb7eacbac95413535452b644cab971efb8c0b5caf0d06d6d8356

1  2 
CHANGELOG.md

diff --cc CHANGELOG.md
index 78fa1657aea50da7b3f7dce9e7ca99eed6bbdde8,4e797aa0fe4f96228edc96729fef71a3b0c64a1d..6506d12decc032fa07d9fb0cb96a4aca4f29b21c
@@@ -6,17 -6,7 +6,18 @@@ and this project adheres to [Semantic V
  
  ## [Unreleased]
  
++- added `OldestFirstCoinSelection` impl to `CoinSelectionAlgorithm`
 +
 +
 +## [v0.18.0] - [v0.17.0]
 +
  - Add `sqlite-bundled` feature for deployments that need a bundled version of sqlite, ie. for mobile platforms.
 +- Added `Wallet::get_signers()`, `Wallet::descriptor_checksum()` and `Wallet::get_address_validators()`, exposed the `AsDerived` trait.
 +- Deprecate `database::Database::flush()`, the function is only needed for the sled database on mobile, instead for mobile use the sqlite database.
 +- Add `keychain: KeychainKind` to `wallet::AddressInfo`.
 +- Improve key generation traits
 +- Rename `WalletExport` to `FullyNodedExport`, deprecate the former.
 +- Bump `miniscript` dependency version to `^6.1`. 
  
  ## [v0.17.0] - [v0.16.1]