33 Commits

Author SHA1 Message Date
LLFourn
a7183f34ef
s/UTXO/LocalUtxo/g
Since this struct has a "keychain" it is not a general "UTXO" but a
local wallet UTXO.
2021-02-26 13:33:52 +11:00
LLFourn
890d6191a1
Remove Option trickery from TxBuilder API
see: https://github.com/bitcoindevkit/bdk/pull/258#issuecomment-754685962
2021-01-22 15:08:30 +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
Justin Moon
7bc8c3c380
[wallet] Add "needed" and "available" metadata to Error::InsufficientFunds 2021-01-13 23:00:37 -06: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
Steve Myers
148e8c6088
[docs] Add docs to the 'wallet' module 2020-12-15 15:12:32 -08: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
9bafdfe2d4
[docs] Various fixes to the docs 2020-12-11 11:16:38 +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
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
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
e6c2823a36
Merge commit 'refs/pull/146/head' of github.com:bitcoindevkit/bdk 2020-10-29 11:53:22 +01:00
Murch
84aee3baab
Rename may_use_utxos to optional_uxtos 2020-10-27 23:24:03 -04:00
Murch
43a51a1ec3
Rename must_use_utxos to required_utxos 2020-10-26 14:40:44 -04:00
Murch
b2ec6e3683
Rename DumbCS to LargestFirstCoinSelection 2020-10-26 14:20:44 -04:00
Alekos Filini
a5713a8348
[wallet] Improve CoinSelectionAlgorithm
Implement the improvements described in issue #121.

Closes #121, closes #131.
2020-10-16 14:30:44 +02:00
LLFourn
17f7294c8e
[wallet] Make coin_select take may/must use utxo lists
so that in the future you can add a UTXO that you *must* spend and let
the coin selection fill in the rest.

This partially addresses #121
2020-10-16 14:28:22 +02:00
Alekos Filini
d7ee38cc52 Rename the library to bdk 2020-09-14 15:13:43 -07:00
Alekos Filini
43cb0331bf
Rename the crate to just "magical" 2020-09-04 17:01:33 +02:00
Alekos Filini
eee75219e0
Write more docs, make TxBuilder::with_recipients take Scripts 2020-09-04 16:07:41 +02:00
Alekos Filini
7065c1fed6
Write more docs 2020-09-04 11:44:49 +02:00
Alekos Filini
c0867a6adc
General cleanup for the docs 2020-08-31 15:04:27 +02:00
Alekos Filini
d61e974dbe
Add the license to every file 2020-08-31 11:48:25 +02:00
Alekos Filini
8d9ccf8d0b
[wallet] Allow limiting the use of internal utxos in TxBuilder 2020-08-10 17:18:13 +02:00
Alekos Filini
7a23b2b558
[wallet] Abstract coin selection in a separate trait 2020-08-06 16:56:41 +02:00