193 Commits

Author SHA1 Message Date
Alekos Filini
fe7ecd3dd2
Merge commit 'refs/pull/167/head' of github.com:bitcoindevkit/bdk 2020-11-18 10:44:54 +01:00
Alekos Filini
a601337e0c
Merge commit 'refs/pull/166/head' of github.com:bitcoindevkit/bdk 2020-11-18 10:31:51 +01:00
Riccardo Casatta
ae16c8b602
fix typo 2020-11-18 09:27:01 +01:00
Alekos Filini
6f4d2846d3
[descriptor] Add support for sortedmulti in descriptor! 2020-11-17 23:57:33 +01:00
Alekos Filini
7a42c5e095
Switch to "mainline" rust-miniscript 2020-11-17 23:57:28 +01:00
Riccardo Casatta
b79fa27aa4
Remove unused varaint HeaderParseFail 2020-11-17 18:54:34 +01:00
Riccardo Casatta
8dfbbf2763
Require esplora feature for repl example 2020-11-17 16:47:58 +01:00
Riccardo Casatta
42480ea37b
Bring less data around 2020-11-17 16:38:19 +01:00
Riccardo Casatta
02c0ad2fca
eagerly unwrap height option, save one collect 2020-11-17 16:37:10 +01:00
Riccardo Casatta
16fde66c6a
use flatten instead of unwrap_or 2020-11-17 15:24:26 +01:00
Riccardo Casatta
2844ddec63
avoid a max() call by checking minus or equal 2020-11-17 15:20:33 +01:00
Riccardo Casatta
7a58d3dd7a
Use filter_map instead of filter and map 2020-11-17 15:16:18 +01:00
Riccardo Casatta
4d1617f4e0
use proper type for EsploraHeader, make conversion to BlockHeader infallible 2020-11-17 15:08:04 +01:00
Riccardo Casatta
3c8b8e4fca
conditionally remove cli args according to enabled feature 2020-11-17 15:00:18 +01:00
Riccardo Casatta
2f39a19b01
Use our Instant struct to be compatible with wasm 2020-11-17 14:25:27 +01:00
Riccardo Casatta
d9985c4bbb
[examples] support esplora blockchain source in repl 2020-11-17 09:39:44 +01:00
Riccardo Casatta
c5dba115a0
[sync] Improve sync
Make every request in batch, to save round trip times
Fetch timestamp of blockheader to populate timestamp field in transaction
Remove listunspent requests because we can compute it from our history
2020-11-17 09:39:43 +01:00
LLFourn
35579cb216
[wallet] Build output lookup inside complete transaction
To avoid the caller having to do it.
2020-11-17 15:11:47 +11:00
LLFourn
fcc408f346
[wallet] Add test that shwpkh populates witness_utxo 2020-11-17 15:11:47 +11:00
LLFourn
004f81b0a8
[wallet] Make coin_select return UTXOs instead of TxIns
- We want to keep the metadata in the UTXO around for things later
- It is easier to turn a UTXO into a TxIn outside
2020-11-17 15:11:47 +11:00
Steve Myers
13c1170304
[ci] Remove actions-rs, cleanup names 2020-11-16 18:46:16 -08:00
Alekos Filini
a30ad49f63
[wallet] Use the branch-and-bound cs by default
Keep the `LargestFirst` coin selection for the tests, to make them more
predictable.
2020-11-16 14:08:04 +01:00
Riccardo Casatta
755d76bf54
remove unneeded pub modifier 2020-11-16 12:11:37 +01:00
Riccardo Casatta
25da54d5ec
ignore .idea 2020-11-16 12:09:14 +01:00
Riccardo Casatta
4f99c77abe
[sync] check last derivation in cache to avoid recomputation 2020-11-16 12:06:48 +01:00
Alekos Filini
ac18fb119f
[keys] Add a shortcut to generate keys with the default options 2020-11-13 17:43:57 +01:00
Alekos Filini
f2edee0e2e
[keys] impl ToDescriptorKey for GeneratedKey 2020-11-13 17:29:01 +01:00
Alekos Filini
f4affbd039
[keys] impl GeneratableKey for bitcoin::PrivateKey 2020-11-13 17:27:19 +01:00
Alekos Filini
d269c9e0b2
[cli] Split the internal and external policy paths 2020-11-13 15:00:22 +01:00
Alekos Filini
7c80aec454
[wallet] Take both spending policies into account in create_tx
This allows specifying different "policy paths" for the internal and external
descriptors, and adds additional checks to make sure they are compatibile (i.e.
the timelocks are expressed in the same unit).

It's still suboptimal, since the `n_sequence`s are per-input and not per-transaction,
so it should be possibile to spend different inputs with different, otherwise
incompatible, `CSV` timelocks, but that requires a larger refactor that
can be done in a future patch.

This commit also tries to clarify how the "policy path" should be used by adding
a fairly detailed example to the docs.
2020-11-13 12:55:42 +01:00
Daniela Brozzoni
9f31ad1bc8
[wallet] Replace must_use with required in coin selection 2020-11-13 12:42:07 +01:00
Daniela Brozzoni
c43f201e35
[wallet] Add tests for BranchAndBoundCoinSelection::single_random_draw 2020-11-13 12:42:06 +01:00
Daniela Brozzoni
23824321ba
[wallet] Add tests for BranchAndBoundCoinSelection::bnb 2020-11-13 12:42:06 +01:00
Daniela Brozzoni
be91997d84
[wallet] Add tests for BranchAndBoundCoinSelection::coin_select 2020-11-13 12:42:06 +01:00
Daniela Brozzoni
99060c5627
[wallet] Add Branch and Bound coin selection 2020-11-13 12:42:06 +01:00
Daniela Brozzoni
a86706d1a6
[wallet] Use TXIN_DEFAULT_WEIGHT constant in coin selection
Replace all the occurences of `serialize(&txin)`
with TXIN_DEFAULT_WEIGHT.
2020-11-13 12:42:06 +01:00
Alekos Filini
36c5a4dc0c
[wallet] Split send_all into set_single_recipient and drain_wallet
Previously `send_all` was particularly confusing, because when used on a
`create_tx` it implied two things:
- spend everything that's in the wallet (if no utxos are specified)
- don't create a change output

But when used on a `bump_fee` it only meant to not add a change output
and instead reduce the only existing output to increase the fee.

This has now been split into two separate options that should hopefully
make it more clear to use, as described in #142.

Additionally, `TxBuilder` now has a "context", that basically allows to
make some flags available only when they are actually meaningful, either
for `create_tx` or `bump_fee`.

Closes #142.
2020-11-05 12:06:43 +01:00
Alekos Filini
f67bfe7bfc
Merge commit 'refs/pull/156/head' of github.com:bitcoindevkit/bdk 2020-11-05 11:44:29 +01:00
LLFourn
796f9f5a70
Make Signer and AddressValidator Send and Sync 2020-11-03 16:16:32 +11:00
LLFourn
3b3659fc0c
Remove redundant Box around signers 2020-11-03 16:06:43 +11:00
LLFourn
5784a95e48
Remove redundant Box around address validators 2020-11-03 16:06:43 +11:00
Steve Myers
f7499cb65d
[ci] test with all features enabled in single run 2020-11-02 19:06:41 -08:00
Steve Myers
40bf9f8b79
[ci] Add code coverage github actions workflow 2020-11-02 13:18:52 -08:00
Riccardo Casatta
30f1ff5ab5
[repl] add max_addresses param in sync 2020-10-30 15:04:09 +01:00
Alekos Filini
e6c2823a36
Merge commit 'refs/pull/146/head' of github.com:bitcoindevkit/bdk 2020-10-29 11:53:22 +01:00
Steve Myers
4a75f96d35
[ci] Enable clippy for stable and tests by default 2020-10-28 21:48:40 -07:00
Steve Myers
4f7355ec82
[ci] Fix all-keys and cli-utils tests 2020-10-28 21:34:04 -07:00
Steve Myers
7b9df5bbe5
[ci] Enable clippy and test for optional features 2020-10-28 17:51:03 -07:00
Steve Myers
8d04128c74
[ci] Fix or ignore clippy warnings for all optional features except compact_filters 2020-10-28 17:50:12 -07:00
Murch
457e70e70f
Rename get_must_may_use_utxos to preselect_utxos 2020-10-27 23:24:03 -04:00