LLFourn
7bf46c7d71
Add comment explaining why params and coin_selection are Options
2021-01-22 14:33:37 +11:00
LLFourn
8319b32466
Fix wrong doc links
2021-01-22 14:33:37 +11:00
LLFourn
5fb7fdffe1
[wallet] Use doctest_wallet!() to remove some no_runs from doctests
...
...and improve the fee bumping example while trying to make it
no_run (but failed).
2021-01-22 14:33:37 +11:00
LLFourn
7553b905c4
[wallet] Overhaul TxBuilder internals and externals
...
Fixes #251
TxBuilders are now not created directly but are created through the
wallet with `build_tx` and `build_fee_bump`.
The advantages of this realised in this commit are:
1. Normal tx creation and fee bumping use the code internally. The only
difference between normal tx and fee bump is how the builder is created.
2. The TxBuilder now has a refernce to the wallet and can therefore
lookup things as methods are called on it. `add_utxo` now uses this to
look up UTXO deta when it is called (rather than having to do it and
possibly error later on).
To support these changes `get_utxo` and `get_descriptor_for_keychain`
public methods have been added to Wallet. I could have kept them
pub(crate) but they seem like fine APIs to have publicly.
2021-01-22 14:33:37 +11:00
LLFourn
f74f17e227
Change "received_tx" into "populate_test_db" macro
...
A `[cfg(test)]` function is not as helpful as a macro since it can't be
called in the context of a doctest.
Also adds doctest_wallet macro which can be used to create a wallet in a
doctest.
2021-01-22 14:23:36 +11:00
Justin Moon
7bc8c3c380
[wallet] Add "needed" and "available" metadata to Error::InsufficientFunds
2021-01-13 23:00:37 -06:00
LLFourn
0c9c0716a4
[wallet] Fix details.fees being wrong when change is dust
2020-12-29 16:36:35 +11:00
LLFourn
656c9c9da8
Use () to indicate a missing blockchain
...
So that:
1. There are no runtime errors
2. There less type annotations needed
3. Less traits and stuff to document
2020-12-23 14:52:29 +11:00
Alekos Filini
63aabe203f
Merge commit 'refs/pull/235/head' of github.com:bitcoindevkit/bdk
2020-12-18 10:41:37 +01:00
Steve Myers
2325a1fcc2
[docs] Format code in docs with '--config format_code_in_doc_comments=true'
2020-12-16 15:12:51 -08:00
Alekos Filini
7e90657ee1
[descriptor] Make the syntax of descriptor!()
more consistent
...
The syntax now is pretty much the same as the normal descriptor syntax,
with the only difference that modifiers cannot be grouped together (i.e.
`sdv:older(144)` must be turned into `s:d:v:older(144)`.
2020-12-16 19:00:55 +01:00
Alekos Filini
5f373180ff
Merge commit 'refs/pull/223/head' of github.com:bitcoindevkit/bdk
2020-12-16 11:11:38 +01:00
Alekos Filini
931a110e4e
Merge commit 'refs/pull/229/head' of github.com:bitcoindevkit/bdk
2020-12-16 10:48:10 +01:00
Steve Myers
148e8c6088
[docs] Add docs to the 'wallet' module
2020-12-15 15:12:32 -08:00
Evgenii P
09730c0898
Take ID into account in SignersContainerKey's PartialEq impl
2020-12-15 22:40:07 +07:00
Alekos Filini
6d9472793c
Merge commit 'refs/pull/228/head' of github.com:bitcoindevkit/bdk
2020-12-15 14:33:59 +01:00
Alekos Filini
eadf50042c
[wallet] Add tests for check_nsequence_rbf
and check_nlocktime
2020-12-15 12:01:44 +01:00
Alekos Filini
322122afc8
[wallet] Set the correct nSequence when RBF and OP_CSV are used
...
This commit also fixes the timelock comparing logic in the policy module, since
the rules are different for absolute (OP_CLTV) and relative (OP_CSV) timelocks.
Fixes #215
2020-12-15 12:01:41 +01:00
Evgenii P
5315c3ef25
rustfmt
2020-12-15 11:36:26 +07:00
Evgenii P
c58236fcd7
Fix SignersContainer::find to filter out incorrect IDs
2020-12-15 11:36:26 +07:00
Evgenii P
2658a9b05a
Fix SignersContainerKey PartialOrd to respect the ID
2020-12-15 11:36:26 +07:00
Evgenii P
c075183a7b
Revert replacing BTreeMap to HashMap in SingersContainer
2020-12-15 11:35:34 +07:00
LLFourn
9b31ae9153
Fix doc comment fallout from s/script type/keychain
2020-12-15 08:39:19 +11:00
Alekos Filini
1713d621d4
Rename ScriptType
to KeychainKind
...
This avoids confusion with the "type of script".
2020-12-14 17:14:24 +01:00
Alekos Filini
0ef0b45745
Merge commit 'refs/pull/224/head' of github.com:bitcoindevkit/bdk
2020-12-14 11:18:51 +01:00
Evgenii P
351b656a82
Use unstable sort by key for performance
2020-12-14 16:27:54 +07:00
Evgenii P
95af38a01d
rustfmt
2020-12-14 01:03:14 +07:00
Evgenii P
3ceaa33de0
Add unit tests for SignersContainer
2020-12-14 01:03:14 +07:00
Evgenii P
5d190aa87d
Remove debug output
2020-12-14 01:02:48 +07:00
Evgenii P
20e0a4d421
Replace BTreeMap with a HashMap
2020-12-13 18:37:27 +07:00
Alekos Filini
9bafdfe2d4
[docs] Various fixes to the docs
2020-12-11 11:16:38 +01:00
Steve Myers
602ae3d63a
Add TODOs for missing_docs
2020-12-07 18:25:16 -08:00
Alekos Filini
eef59e463d
Merge commit 'refs/pull/210/head' of github.com:bitcoindevkit/bdk
2020-12-07 11:21:21 +01:00
LLFourn
8dcb75dfa4
Replace UTXO::is_internal with script_type
...
This means less conversion and logic mapping from bool to ScriptType and
back again.
2020-12-04 10:46:25 +11:00
Steve Myers
2e7f98a371
Fix docs
2020-12-02 16:57:59 -08:00
Alekos Filini
5d352ecb63
[wallet] Add tests for TxBuilder::add_global_xpubs()
2020-12-01 16:43:40 +01:00
Alekos Filini
ebfe5db0c3
[wallet] Add a flag to fill-in PSBT_GLOBAL_XPUB
2020-12-01 16:43:38 +01:00
LLFourn
67957a93b9
[wallet] Add wallet.network()
2020-12-01 13:29:20 +11:00
LLFourn
dd35903660
Remove trait bounds on Wallet struct
...
see: https://github.com/rust-lang/api-guidelines/issues/6
2020-11-24 12:40:58 +11:00
LLFourn
acc0ae14ec
[wallet] Eagerly finalize inputs
...
If we know the final witness/scriptsig for an input we should add it
right away to the PSBT. Before, if we couldn't finalize any of them we
finalized none of them.
2020-11-23 16:07:50 +11:00
Justin Moon
b1b2f2abd6
[wallet] Don't wrap SignersContainer arguments in Arc
2020-11-19 10:27:33 -06:00
Justin Moon
f9d3467397
[wallet] Add witness and redeem scripts to PSBT outputs
2020-11-18 11:40:34 -06:00
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
Alekos Filini
7a42c5e095
Switch to "mainline" rust-miniscript
2020-11-17 23:57:28 +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
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
4f99c77abe
[sync] check last derivation in cache to avoid recomputation
2020-11-16 12:06:48 +01:00