-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce new bdk_coin_select
implementation
#1072
Closed
Closed
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
7dad80c
Move bdk_coin_select in from old PR
LLFourn 270916b
Include the SPK length field weight in TXOUT_BASE_weight
LLFourn 0e504ef
Fix weight calculations for mixed legacy and segwit
LLFourn ce2fad9
feat(coin_select): add `DrainWeights` and `min_value_and_waste` policy
evanlinjin b4098de
feat(coin_select): add `CoinSelector::fund_outputs` method
evanlinjin 9cd79fe
feat(coin_select)!: Add `CoinSelector::run_bnb`
evanlinjin 0ab8042
feat(coin_select): Implement `LowestFee` metric
evanlinjin 3745b9e
test(coin_select): prop tests for metrics
evanlinjin a14d7c6
test(coin_select): fix `waste_prop_waste` from timing out
evanlinjin 84ed9fa
test(coin_select): add inner prop test methods
evanlinjin fa466ae
fix(coin_select): make bnb more efficient with identical candidates
evanlinjin cdbe775
feat(coin_select): implement `WasteChangeless` metric
evanlinjin 97e17d4
feat(coin_select): tighten bounds of `lowest_fee` metric
evanlinjin f2597cc
feat(coin_select): add bnb `insert_new_branches` optimization
evanlinjin b13b1ce
feat(coin_select): downgrade dev dependencies to work with MSRV
evanlinjin 00c7f30
test(coin_select): refactor proptest helpers to avoid `Box::leak`
evanlinjin 22e0fb4
test(coin_select): also test min_fee in proptests and docs
evanlinjin c3056fd
feat(coin_select)!: add ability to combine scores from different metrics
evanlinjin 82f0eab
test(coin_select): test `LowestFee` + `Changeless` combined metric
evanlinjin 29780ce
doc(coin_select): make clippy happy
evanlinjin 5513f6c
coin_select: rm `waste_changeless` metric
evanlinjin 53de6d1
coin_select: make changeless test pass
evanlinjin 19e50d5
chore(coin_select): make code work with 1.57 MSRV
evanlinjin aa425f8
chore(coin_select): handle all TODOs
evanlinjin 2cf8304
chore(coin_select): rm debug assertion in `LowestFee` metric
evanlinjin 2a06d73
chore(coin_select): temporarily comment out failing waste proptest
evanlinjin 476bc87
docs(coin_select): update README
evanlinjin d620dc6
chore(coin_select): update `Cargo.toml`
evanlinjin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[workspace] | ||
members = [ | ||
"nursery/coin_select" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env sh | ||
trap ' | ||
signal=$?; | ||
cleanup | ||
exit $signal; | ||
' INT | ||
|
||
cleanup() { | ||
mv Cargo.tmp.toml Cargo.toml 2>/dev/null | ||
} | ||
|
||
cp Cargo.toml Cargo.tmp.toml | ||
cp Cargo.1.48.0.toml Cargo.toml | ||
cat Cargo.toml | ||
cargo build --release | ||
cleanup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -836,7 +836,7 @@ mod test { | |
let drain_script = ScriptBuf::default(); | ||
let target_amount = 250_000 + FEE_AMOUNT; | ||
|
||
let result = LargestFirstCoinSelection::default() | ||
let result = LargestFirstCoinSelection | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. huh why are we changing this file? |
||
.coin_select( | ||
utxos, | ||
vec![], | ||
|
@@ -857,7 +857,7 @@ mod test { | |
let drain_script = ScriptBuf::default(); | ||
let target_amount = 20_000 + FEE_AMOUNT; | ||
|
||
let result = LargestFirstCoinSelection::default() | ||
let result = LargestFirstCoinSelection | ||
.coin_select( | ||
utxos, | ||
vec![], | ||
|
@@ -878,7 +878,7 @@ mod test { | |
let drain_script = ScriptBuf::default(); | ||
let target_amount = 20_000 + FEE_AMOUNT; | ||
|
||
let result = LargestFirstCoinSelection::default() | ||
let result = LargestFirstCoinSelection | ||
.coin_select( | ||
vec![], | ||
utxos, | ||
|
@@ -900,7 +900,7 @@ mod test { | |
let drain_script = ScriptBuf::default(); | ||
let target_amount = 500_000 + FEE_AMOUNT; | ||
|
||
LargestFirstCoinSelection::default() | ||
LargestFirstCoinSelection | ||
.coin_select( | ||
vec![], | ||
utxos, | ||
|
@@ -918,7 +918,7 @@ mod test { | |
let drain_script = ScriptBuf::default(); | ||
let target_amount = 250_000 + FEE_AMOUNT; | ||
|
||
LargestFirstCoinSelection::default() | ||
LargestFirstCoinSelection | ||
.coin_select( | ||
vec![], | ||
utxos, | ||
|
@@ -935,7 +935,7 @@ mod test { | |
let drain_script = ScriptBuf::default(); | ||
let target_amount = 180_000 + FEE_AMOUNT; | ||
|
||
let result = OldestFirstCoinSelection::default() | ||
let result = OldestFirstCoinSelection | ||
.coin_select( | ||
vec![], | ||
utxos, | ||
|
@@ -956,7 +956,7 @@ mod test { | |
let drain_script = ScriptBuf::default(); | ||
let target_amount = 20_000 + FEE_AMOUNT; | ||
|
||
let result = OldestFirstCoinSelection::default() | ||
let result = OldestFirstCoinSelection | ||
.coin_select( | ||
utxos, | ||
vec![], | ||
|
@@ -977,7 +977,7 @@ mod test { | |
let drain_script = ScriptBuf::default(); | ||
let target_amount = 20_000 + FEE_AMOUNT; | ||
|
||
let result = OldestFirstCoinSelection::default() | ||
let result = OldestFirstCoinSelection | ||
.coin_select( | ||
vec![], | ||
utxos, | ||
|
@@ -999,7 +999,7 @@ mod test { | |
let drain_script = ScriptBuf::default(); | ||
let target_amount = 600_000 + FEE_AMOUNT; | ||
|
||
OldestFirstCoinSelection::default() | ||
OldestFirstCoinSelection | ||
.coin_select( | ||
vec![], | ||
utxos, | ||
|
@@ -1018,7 +1018,7 @@ mod test { | |
let target_amount: u64 = utxos.iter().map(|wu| wu.utxo.txout().value).sum::<u64>() - 50; | ||
let drain_script = ScriptBuf::default(); | ||
|
||
OldestFirstCoinSelection::default() | ||
OldestFirstCoinSelection | ||
.coin_select( | ||
vec![], | ||
utxos, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,22 @@ | ||
[package] | ||
name = "bdk_coin_select" | ||
version = "0.0.1" | ||
authors = [ "LLFourn <[email protected]>" ] | ||
version = "0.1.0" | ||
edition = "2021" | ||
rust-version = "1.57" | ||
homepage = "https://bitcoindevkit.org" | ||
repository = "https://github.com/bitcoindevkit/bdk" | ||
documentation = "https://docs.rs/bdk_coin_select" | ||
description = "Tools for input selection for making Bitcoin transactions." | ||
license = "MIT OR Apache-2.0" | ||
readme = "README.md" | ||
|
||
[dependencies] | ||
bdk_chain = { path = "../../crates/chain" } | ||
# No dependencies! Don't add any please! | ||
|
||
[dev-dependencies] | ||
rand = "0.7" | ||
proptest = "0.10" | ||
bitcoin = "0.30" | ||
|
||
[features] | ||
default = ["std"] | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should instead just put this code in a separate repo in the bdk org and have our own MSRV for it.