LLFourn
ea8488b2a7
Initialize env_logger at start of blockchain tests
2021-05-21 13:21:59 +10:00
LLFourn
d2a981efee
run_blockchain_tests.sh improvements
2021-05-21 13:21:41 +10:00
LLFourn
4c92daf517
Uppercase 'Test' so that github can see what's up
...
It is expecting something named 'Test electrum'
2021-05-20 14:33:02 +10:00
LLFourn
aba2a05d83
Add script for running the blockchain tests locally
2021-05-19 16:45:48 +10:00
LLFourn
5b194c268d
Fix clippy warnings inside testutils macro
...
Now that it's inside the main repo clippy is having a go at me.
2021-05-19 16:45:48 +10:00
LLFourn
00bdf08f2a
Remove testutils feature so doctests worka again
...
I wanted to only conditionally compile testutils but it's needed in
doctests which we can't conditionally compile for:
https://github.com/rust-lang/rust/issues/67295
2021-05-19 16:45:48 +10:00
LLFourn
38b0470b14
Move blockchain related stuff to blockchain_tests
2021-05-19 16:45:48 +10:00
LLFourn
d60c5003bf
Merge testutils crate into the main crate
...
This avoids having to keep the apis in sync between the macros and the
main project.
2021-05-19 16:45:48 +10:00
LLFourn
fcae5adabd
Run blockchain tests on esplora
...
They were only being run on electrum before.
2021-05-19 15:47:44 +10:00
LLFourn
465ef6e674
Roll blockchain tests proc macro into normal macro
...
This means one less crate in the repo. Had to do a Default on TestClient
to satisfy clippy.
2021-05-18 20:02:33 +10:00
LLFourn
5a0c150ff9
Make wallet methods take &mut psbt
...
Rather than consuming it because that is unergonomic.
2021-04-28 15:34:25 +10:00
LLFourn
882a9c27cc
Use tagged serialization for blockchain config
...
also make the config types Clone and PartialEq
2021-04-03 15:30:49 +11:00
LLFourn
ac7c1bd97b
Clean up add_foreign_utxo tests a bit
...
Noticed some suboptimal things while reviewing myself.
2021-02-26 13:33:52 +11:00
LLFourn
d9a102afa9
Improve docs of satisfaction_weight
2021-02-26 13:33:52 +11:00
LLFourn
1fbfeabd77
Added add_foreign_utxo
...
To allow adding UTXOs external to the current wallet.
The caller must provide the psbt::Input so we can create a coherent PSBT
at the end and so this is compatible with existing PSBT workflows.
Main changes:
- There are now two types of UTXOs, local and foreign reflected in a
`Utxo` enum.
- `WeightedUtxo` now captures floating `(Utxo, usize)` tuples
- `CoinSelectionResult` now has methods on it for distinguishing between
local amount included vs total.
2021-02-26 13:33:52 +11:00
LLFourn
9a918f285d
Make TxBuilder actually Clone
...
it derived Clone but in practice it was never clone because some of the
parameters were not Clone.
2021-02-26 13:33:52 +11:00
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
6689384c8a
Merge branch 'master' into make_txbuilder_take_ref_to_wallet
2021-01-30 13:12:13 +11:00
LLFourn
35a61f5759
Fix whitespace and curse emacs
2021-01-30 13:05:23 +11:00
LLFourn
d0ffd5606a
Fix CHANGELOG to mention s/utxos/add_utxos/
2021-01-30 12:58:05 +11:00
LLFourn
dbf8cf7674
Make maintain_single_recipient return a Result
...
preferable to panicking.
2021-01-29 12:33:07 +11:00
LLFourn
ff10aa5ceb
Add "add_utxos" method on TxBuilder
...
To replace the previously existing ".utxos"
2021-01-22 15:08:31 +11:00
LLFourn
21d382315a
Remove not very useful comment
...
Thanks @tcharding.
2021-01-22 15:08:30 +11:00
LLFourn
6fe3be0243
Derive Clone + Debug for TxBuilder
...
And make Wallet Debug while I'm at it.
2021-01-22 15:08:30 +11:00
LLFourn
10fcba9439
Revert back to Vec to hold utxos in builder
...
Due to brain malfunction I made utxos into a BTree. This made a test
pass but is incorrect. The test itself was incorrect as per comment in
https://github.com/bitcoindevkit/bdk/pull/258#issuecomment-758370380
So I (1) reverted utxos back to a Vec, (2) fixed the test and expanded
the comment in the test.
2021-01-22 15:08:30 +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
735db02850
Assert that .finish() hasn't been called already in coin_selection
2021-01-22 14:33:37 +11:00
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
0faca43744
Make testutils dependency path relative
2021-01-22 14:33:37 +11:00
LLFourn
6f66de3d16
Update Changelog for Tx creation overhaul
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
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
LLFourn
a578d20282
Fix incredibly annoying cargo-fmt problem
...
I must have a newer version of cargo-fmt which stops me from making
commits every time because of this.
2020-12-22 14:37:53 +11:00
LLFourn
9b31ae9153
Fix doc comment fallout from s/script type/keychain
2020-12-15 08:39:19 +11: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
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
LLFourn
d2490d9ce3
Fix to at least bitcoin ^0.25.2
...
And fix the fallout.
2020-11-23 15:06:13 +11: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
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
LLFourn
8d65581825
Incorporate RBF rules into utxo selection function
2020-10-23 13:54:59 +11:00
LLFourn
a6b70af2fb
[wallet] Stop implicitly enforcing manaul selection by .add_utxo
...
This makes it possible to choose a UTXO manually without having to
choose them *all* manually. I introduced the `manually_selected_only`
option to enforce that only manually selected utxos can be used.
To stop the cli semantics changing I made the `utxos` keep the old
behaviour by calling `manually_selected_only`.
2020-10-23 13:54:59 +11:00
LLFourn
b87c7c5dc7
[wallet] Make 'unspendable' into a HashSet
...
to avoid awkwardly later on.
2020-10-23 13:54:59 +11:00
LLFourn
c549281ace
[wallet] Replace ChangeSpendPolicy::filter_utxos with a predicate
...
To make composing it with other filtering conditions easier.
2020-10-23 13:54:59 +11: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
LLFourn
64b4cfe308
Use collect to avoid iter unwrapping Options
2020-10-15 13:41:36 +11:00
LLFourn
490c88934e
[keys] Less convoluted entropy generation
...
Since const generics aren't in rust yet you have to find some awkward
workarounds. This improves the workaround for specifying entropy length.
2020-09-30 20:05:17 +10:00
LLFourn
6a2d0db674
Remove assumed "/api" prefix from esplora
...
It is not necessary that esplora is hosted with a /api prefix
2020-09-05 14:00:50 +10:00