The previous commit b9c5b9d08b040faf6c6b2d9b3745918031555b72 added
IndexSpk. This goes further and adds `Indexed` and `KeychainIndexed`
type alises (IndexSpk is Indexed<ScriptBuf>) and attempts to standardize
the structure of return types more generally.
The underlying SpkTxOutIndex should not use DescriptorIds to index
because this loses the ordering relationship of the spks so queries on
subranges of keychains work.
Along with that we enforce that there is a strict 1-to-1 relationship
between descriptors and keychains. Violating this leads to an error in
insert_descriptor now.
In general I try to make the translation layer between the SpkTxOutIndex
and the KeychainTxOutIndex thinner. Ergonomics of this will be improved
in next commit.
The test from the previous commit passes.
11200810d048abb8deb3c7961ca93c68011d41fd chore(wallet): rm dup code (志宇)
2a4564097bd70905ed9fa21b92cdf074a72f878e deps(bdk): bump `bitcoin` to `0.32.0`, miniscript to `12.0.0` (Leonardo Lima)
Pull request description:
fixes#1422
<!-- You can erase any parts of this template not applicable to your Pull Request. -->
### Description
This PR focuses on upgrading the `rust-bitcoin` and `miniscript` versions, to `0.32.0` and `0.12.0`, respectively. It also bumps the versions of other BDK ecosystem crates that also rely on both `rust-bitcoin` and `miniscript`, being:
- electrum-client https://github.com/bitcoindevkit/rust-electrum-client/pull/133
- esplora-client https://github.com/bitcoindevkit/rust-esplora-client/pull/85
- hwi https://github.com/bitcoindevkit/rust-hwi/pull/99
<ins>I structured the PR in multiple commits, with closed scope, being one for each BDK crate being upgraded, and one for each kind of fix and upgrade required, it seems like a lot of commits (**that should be squashed before merging**), but I think it'll make it easier during review phase.</ins>
In summary I can already mention some of the main changes:
- using `compute_txid()` instead of deprecated `txid()`
- using `minimal_non_dust()` instead of `dust_value()`
- using the renamed `signature` and `sighash_type` fields
- using proper `sighash::P2wpkhError`, `sighash::TaprootError` instead of older `sighash::Error`
- conversion from `Network` to new expected `NetworkKind` #1465
- conversion from the new `Weight` type to current expected `usize` #1466
- using `.into()` to convert from AbsLockTime and `RelLockTime` to `absolute::LockTime` and `relative::LockTime`
- using Message::from_digest() instead of relying on deprecated `ThirtyTwoByteHash` trait.
- updating the miniscript policy and dsl to proper expect and handle new `Threshold` type, instead of the previous two parameters.
<!-- Describe the purpose of this PR, what's being adding and/or fixed -->
### Notes to the reviewers
<ins>Again, I structured the PR in multiple commits, with closed scope, being one for each BDK crate being upgraded, and one for each kind of fix and upgrade required, it seems like a lot of commits (**that should be squashed before merging**), but I think it'll make it easier during review phase.</ins>
It should definitely be carefully reviewed, especially the last commits for the wallet crate scope, the ones with the semantic `fix(wallet)`.
I would also appreciate if @tcharding reviewed it, as he gave a try in the past (#1400 ), and I relied on some of it for the policy part of it, other rust-bitcoin maintainers reviews are a definitely welcome 😁
<!-- In this section you can include notes directed to the reviewers, like explaining why some parts
of the PR were done in a specific way -->
### Changelog notice
> // TODO(@oleonardolima): Do another pass and double check the changes
- Use `compute_txid()` instead of deprecated `txid()`
- Use `minimal_non_dust()` instead of `dust_value()`
- Use `signature` and `sighash_type` fields, instead of previous `sig` and `hash_type`
- Use `sighash::P2wpkhError`, and `sighash::TaprootError` instead of older `sighash::Error`
- Converts from `Network` to `NetworkKind`, where expected
- Converts from `Weight` type to current used `usize`
- Use `.into()` to convert from `AbsLockTime` and `RelLockTime` to `absolute::LockTime` and `relative::LockTime`
- Remove use of deprecated `ThirtyTwoByteHash` trait, use `Message::from_digest()`
- Update the miniscript policy and dsl macros to proper expect and handle new `Threshold` type, instead of the previous two parameters.
<!-- Notice the release manager should include in the release tag message changelog -->
<!-- See https://keepachangelog.com/en/1.0.0/ for examples -->
### Checklists
#### All Submissions:
* [x] I've signed all my commits
* [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
* [x] I ran `cargo fmt` and `cargo clippy` before committing
#### New Features:
* [ ] I've added tests for the new feature
* [ ] I've added docs for the new feature
#### Bugfixes:
* [ ] This pull request breaks the existing API
* [ ] I've added tests to reproduce the issue which are now passing
* [ ] I'm linking the issue being fixed by this PR
ACKs for top commit:
notmandatory:
ACK 11200810d048abb8deb3c7961ca93c68011d41fd
Tree-SHA512: ba1ab64603b41014d3f0866d846167f77d31959ca6f1d9c3181d5e543964f5d772e05651d63935ba7bbffeba41a66868d27de4c32129739b9ca50f3bbaf9f2a1
Methods `make_multi` and `make_multi_a` were essentially the same thing
except for a different const generic param on `Threshold`. So we rm
`make_multi_a` and put a const generic param on `make_multi`.
deps(chain): bump `bitcoin` to `0.32.0`, miniscript to `12.0.0`
fix(chain): use `minimal_non_dust()` instead of `dust_value()`
fix(chain): use `compute_txid()` instead of `txid`
deps(testenv): bump `electrsd` to `0.28.0`
deps(electrum): bump `electrum-client` to `0.20.0`
fix(electrum): use `compute_txid()` instead of `txid`
deps(esplora): bump `esplora-client` to `0.8.0`
deps(bitcoind_rpc): bump `bitcoin` to `0.32.0`, `bitcoincore-rpc` to
`0.19.0`
fix(bitcoind_rpc): use `compute_txid()` instead of `txid`
fix(nursery/tmp_plan): use proper `sighash` errors, and fix the expected
`Signature` fields
fix(sqlite): use `compute_txid()` instead of `txid`
deps(hwi): bump `hwi` to `0.9.0`
deps(wallet): bump `bitcoin` to `0.32.0`, miniscript to `12.0.0`
fix(wallet): use `compute_txid()` and `minimal_non_dust()`
- update to use `compute_txid()` instead of deprecated `txid()`
- update to use `minimal_non_dust()` instead of `dust_value()`
- remove unused `bitcoin::hex::FromHex`.
fix(wallet): uses `.into` conversion on `Network` for `NetworkKind`
- uses `.into()` when appropriate, otherwise use the explicit
`NetworkKind`, and it's `.is_mainnet()` method.
fix(wallet): add P2wpkh, Taproot, InputsIndex errors to `SignerError`
fix(wallet): fields on taproot, and ecdsa `Signature` structure
fix(wallet/wallet): convert `Weight` to `usize` for now
- converts the `bitcoin-units::Weight` type to `usize` with help of
`to_wu()` method.
- it should be updated/refactored in the future to handle the `Weight`
type throughout the code instead of current `usize`, only converting
it for now.
- allows the usage of deprecated `is_provably_unspendable()`, needs
further discussion if suggested `is_op_return` is suitable.
- update the expect field to `signature`, as it was renamed from `sig`.
fix(wallet/wallet): use `is_op_return` instead of
`is_provably_unspendable`
fix(wallet/wallet): use `relative::Locktime` instead of `Sequence`
fix(wallet/descriptor): use `ParsePublicKeyError`
fix(wallet/descriptor): use `.into()` to convert from `AbsLockTime` and
`RelLockTime` to `absolute::LockTime` and `relative::LockTime`
fix(wallet/wallet): use `Message::from_digest()` instead of relying on
deprecated `ThirtyTwoByteHash` trait.
fix(wallet/descriptor+wallet): expect `Threshold` type, and handle it
internally
fix(wallet/wallet): remove `0x` prefix from expected `TxId` display
fix(examples): use `compute_txid()` instead of `txid`
fix(ci): remove usage of `bitcoin/no-std` feature
- remove comment: `# The `no-std` feature it's implied when the `std` feature is disabled.`
29c8a00b435bdf2fa1d7c707ad09c1a47edc07b3 chore(wallet): remove duplicated InsufficientFunds error member from CreateTxError (e1a0a0ea)
Pull request description:
closes#1440
### Description
- Replace `CreateTxError::InsufficientFunds` use by `coin_selection::Error::InsufficientFunds`
- Remove `InsufficientFunds` member from `CreateTxError` enum
- Rename `coin_selection::Error` to `coin_selection::CoinSelectionError`
### Notes to the reviewers
- We could also keep both members but rename one of them to avoid confusion
### Checklists
#### All Submissions:
* [X] I've signed all my commits
* [X] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
* [X] I ran `cargo fmt` and `cargo clippy` before committing
ACKs for top commit:
evanlinjin:
ACK 29c8a00b435bdf2fa1d7c707ad09c1a47edc07b3
notmandatory:
ACK 29c8a00b435bdf2fa1d7c707ad09c1a47edc07b3
Tree-SHA512: a1132d09929f99f0a5e82d3ccfaa85695ae50d7d4d5d9e8fd9ef847313918ed8c7a01005f45483fef6aeae36730a0da2fed9a9f10c3ce2f0a679527caf798bfe
8bc3d35f6c83d078551c4bc57f72f13324865486 fix(wallet): `LoadError::MissingDescriptor` includes the missing KeychainKind (valued mammal)
412dee1f5b027af7800ee155717d47f4ab4b60e0 ref(wallet)!: Make `Wallet::public_descriptor` infallible (valued mammal)
c2513e1090374d7871a8623845bd10757e6ab0b3 test(wallet): Clarify docs for get_funded_wallet (valued mammal)
9d954cf7d25d43c77115cd931407005a09365389 refactor(wallet)!: Make Wallet require a change descriptor (valued mammal)
Pull request description:
All `Wallet` constructors are modified to require a change descriptor, where previously it was optional. Additionally we enforce uniqueness of the change descriptor to avoid ambiguity when deriving scripts and ensure the wallet will always have two distinct keystores.
Notable changes
* Add error `DescriptorError::ExternalAndInternalAreTheSame`
* Remove error `CreateTxError::ChangePolicyDescriptor`
* No longer rely on `map_keychain`
fixes#1383
### Notes to the reviewers
### Changelog notice
Changed:
Constructing a Wallet now requires two distinct descriptors.
### Checklists
#### All Submissions:
* [x] I've signed all my commits
* [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
* [x] I ran `cargo fmt` and `cargo clippy` before committing
ACKs for top commit:
notmandatory:
re-ACK 8bc3d35f6c83d078551c4bc57f72f13324865486
Tree-SHA512: f0621deb75d8e1e484b18b40d850f64e26314e39c4778f56c627763ddbffd376288bf6f0f37b61ba2ba744c7083683497d2dfef42bc4ef7d3ed7b374a54d813a
All `Wallet` constructors are modified to require a change
descriptor, where previously it was optional. Additionally
we enforce uniqueness of the change descriptor to avoid
ambiguity when deriving scripts and ensure the wallet will
always have two distinct keystores.
Notable changes
* Add error DescriptorError::ExternalAndInternalAreTheSame
* Remove error CreateTxError::ChangePolicyDescriptor
* No longer rely on `map_keychain`
2d2656acfa83ab4c4846c0aab14072efb64c5cc3 feat(electrum): re-export `transaction_broadcast` method (志宇)
53fa35096fbeea2b82b28987e8ef6f7d39ffc80b refactor(electrum)!: put the tx cache in electrum (LLFourn)
Pull request description:
Previously there was a `TxCache` that you passed in as part of the sync request. There are lots of downsides to this:
1. If the user forgets to do this you cache nothing
2. where are you meant to keep this cache? The example shows it being recreated every time which seems very suboptimal.
3. More API and documentation surface area.
Instead just do a plain old simple cache inside the electrum client. This way at least you only download transactions once. You can pre-populate the cache with a method also and I did this in the examples.
* [x] This pull request breaks the existing API
ACKs for top commit:
evanlinjin:
self-ACK 2d2656acfa83ab4c4846c0aab14072efb64c5cc3
notmandatory:
ACK 2d2656acfa83ab4c4846c0aab14072efb64c5cc3
Tree-SHA512: 6c29fd4f99ea5bd66234d5cdaf4b157a192ddd3baacc91076e402d8df0de7010bc482e24895e85fcb2f805ec6d1ce6cdb7654f8f552c90ba75ed35f80a00b856
50137b0425fe9c9aac8caaacf099bfe6c69859c2 refactor(wallet): rename get_balance() to balance() (Steve Myers)
Pull request description:
### Description
fixes#1221
### Notes to the reviewers
See discussion in #1221.
### Changelog notice
Changed
- Wallet::get_balance() renamed to Wallet::balance()
### Checklists
#### All Submissions:
* [x] I've signed all my commits
* [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
* [x] I ran `cargo fmt` and `cargo clippy` before committing
ACKs for top commit:
LagginTimes:
ACK 50137b0425fe9c9aac8caaacf099bfe6c69859c2
oleonardolima:
ACK 50137b0425fe9c9aac8caaacf099bfe6c69859c2
evanlinjin:
ACK 50137b0425fe9c9aac8caaacf099bfe6c69859c2
Tree-SHA512: 20d188a32c79eca37b4f269e5bcdb8c2ecd595911558cb74812a37da13a4f39b603deed3bc11356aa6523b16417a2a025046b3dd4df5bd7247f39c29d7f48ac2
a03949adb0c38ba4c2f44b497871070c1a2170d2 feat: use `Amount` on `calculate_fee`, `fee_absolute`, `fee_amount` and others (Leonardo Lima)
Pull request description:
builds on top of #1411, further improves #823
<!-- You can erase any parts of this template not applicable to your Pull Request. -->
### Description
It further updates and adds the usage of `bitcoin::Amount` instead of `u64`.
<!-- Describe the purpose of this PR, what's being adding and/or fixed -->
### Notes to the reviewers
Open for comments and discussions.
<!-- In this section you can include notes directed to the reviewers, like explaining why some parts
of the PR were done in a specific way -->
### Changelog notice
- Updated `CreateTxError::FeeTooLow` to use `bitcoin::Amount`.
- Updated `Wallet::calculate_fee()`. to use `bitcoin::Amount`
- Updated `TxBuilder::fee_absolute()`. to use `bitcoin::Amount`.
- Updated `CalculateFeeError::NegativeFee` to use `bitcoin::SignedAmount`.
- Updated `TxGraph::calculate_fee()`. to use `bitcoin::Amount`.
- Updated `PsbUtils::fee_amount()` to use `bitcoin::Amount`.
<!-- Notice the release manager should include in the release tag message changelog -->
<!-- See https://keepachangelog.com/en/1.0.0/ for examples -->
### Checklists
#### All Submissions:
* [x] I've signed all my commits
* [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
* [x] I ran `cargo fmt` and `cargo clippy` before committing
#### New Features:
* [x] I've added tests for the new feature
* [x] I've added docs for the new feature
ACKs for top commit:
storopoli:
ACK a03949adb0c38ba4c2f44b497871070c1a2170d2
Tree-SHA512: abfbf7d48ec004eb448ed0a928e7e64b5f82a2ab51ec278fede4ddbff4eaba16469a7403f78dfeba1aba693b0132a528bc7c4ef072983cbbcc2592993230e40f
Previously there was a tx cache that you passed in as part of the sync
request. This seems bad and the example show'd that you should copy all
your transactions from the transaction graph into the sync request every
time you sync'd. If you forgot to do this then you would always download everything.
Instead just do a plain old simple cache inside the electrum client.
This way at least you only download transactions once. You can
pre-populate the cache with a method also and I did this in the examples.
- update to use `bitcoin::Amount` on `CreateTxError::FeeTooLow` variant.
- update to use `bitcoin::Amount` on `Wallet::calculate_fee()`.
- update to use `bitcoin::Amount` on `FeePolicy::fee_absolute()`.
- update to use `bitcoin::SignedAmount` on
`CalculateFeeError::NegativeFee` variant.
- update to use `bitcoin::Amount` on `TxGraph::calculate_fee()`.
- update to use `bitcoin::Amount` on `PsbUtils::fee_amount()`
108061dddbba99f03d7416a673135211ef94043b Bump bdk version to 1.0.0-alpha.12 (Steve Myers)
Pull request description:
### Description
fixes#1449
bdk_chain to 0.15.0
bdk_bitcoind_rpc to 0.11.0
bdk_electrum to 0.14.0
bdk_esplora to 0.14.0
bdk_persist to 0.3.0
bdk_file_store to 0.12.0
bdk_sqlite keep at 0.1.0
bdk_testenv to 0.5.0
bdk_hwi to 0.1.0
bdk_wallet to 1.0.0-alpha.12
### Notes to the reviewers
I also (hopefully) fixed the `bdk_hwi` crate so it can be published.
ACKs for top commit:
ValuedMammal:
ACK 108061dddbba99f03d7416a673135211ef94043b
storopoli:
ACK 108061dddbba99f03d7416a673135211ef94043b
Tree-SHA512: 2a80c51e254ca011b8e9bb72ad3d720dd8d09a3142e85cf230ffffad747257d91c45950cce64b049bab91f21c70c622f14d46def24ea78459497b42472a1fe48
bdk_chain to 0.15.0
bdk_bitcoind_rpc to 0.11.0
bdk_electrum to 0.14.0
bdk_esplora to 0.14.0
bdk_persist to 0.3.0
bdk_file_store to 0.12.0
bdk_sqlite keep at 0.1.0
bdk_testenv to 0.5.0
bdk_hwi to 0.1.0
bdk_wallet to 1.0.0-alpha.12
1b7c6df569a0ff9324bbda1f066938490109481d fix(export): add tr descriptor (rustaceanrob)
Pull request description:
### Description
Resolves#860 by adding export of taproot descriptors
### Notes to the reviewers
Allows export as Core accepts taproot.
### Changelog notice
- Export taproot descriptors
### Checklists
#### All Submissions:
* [x] I've signed all my commits
* [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
* [x] I ran `cargo fmt` and `cargo clippy` before committing
#### New Features:
* [x] I've added tests for the new feature
* [ ] I've added docs for the new feature
#### Bugfixes:
* [ ] This pull request breaks the existing API
* [ ] I've added tests to reproduce the issue which are now passing
* [x] I'm linking the issue being fixed by this PR
ACKs for top commit:
notmandatory:
ACK 1b7c6df569a0ff9324bbda1f066938490109481d
Tree-SHA512: 80bee93a1ec531717e79a5e7a91e840532ae4d3daf677a207bc53162c69410e47db4893024b3eccfd848f1628062e7c49f0e92ebeb7230e2ebb9b47eb84b9e56
096b8ef781b21e7da690b9ca2e4b326880d6ac0b fix(wallet): remove TxBuilder::allow_shrinking function and TxBuilderContext (Steve Myers)
Pull request description:
### Description
Remove wallet::TxBuilder::allow_shrinking() and unneeded TxBuilder context param.
Fixes#1374
### Notes to the reviewers
The allow_shrinking function was the only one using the TxBuilder FeeBump context and it's useful to have CreateTx context functions available for building FeeBump transactions, see updated tests.
### Changelog notice
Changed
- Removed TxBuilder::allow_shrinking() function.
### Checklists
#### All Submissions:
* [x] I've signed all my commits
* [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
* [x] I ran `cargo fmt` and `cargo clippy` before committing
#### Bugfixes:
* [x] This pull request breaks the existing API
* [ ] I've added tests to reproduce the issue which are now passing
* [x] I'm linking the issue being fixed by this PR
Top commit has no ACKs.
Tree-SHA512: f4f05ce4cfaced9e61eebc0ebfe77a299fae13df4459fc26c90657297a1347a5d16f22b4e1c8b9b10458cfec80ca3b5d698eee11c7a560fd83f94a1ac7101a86
475c5024ecc5d288f35fabb8fab2b62dbf67653b feat(sqlite): add bdk_sqlite crate implementing PersistBackend backed by a SQLite database (Steve Myers)
b8aa76cd050bc3c2eac776ecbd9b4e2ab3e2590e feat(wallet): use the new `CombinedChangeSet` of `bdk_persist` (志宇)
0958ff56b20c1325a7da5d5f21e7ac836c601f1f feat(persist): introduce `CombinedChangeSet` (志宇)
54942a902d3203ee59731f35d2a1c402ac626878 ci: bump build_docs rust version to nightly-2024-05-12 (Steve Myers)
d975a48e7c519a703441e74058321021957b177f docs: update README MSRV pinning to match CI (Steve Myers)
Pull request description:
### Description
Add "bdk_sqlite_store" crate implementing `PersistBackend` backed by a SQLite database.
### Notes to the reviewers
In addition to adding a SQLite based `PersistenceBackend` this PR also:
* add `CombinedChangeSet` in `bdk_persist` and update `wallet` crate to use it.
* updates the `wallet/tests` to also use this new sqlite store crate.
* updates `example-crates/wallet_esplora_async` to use this new sqlite store crate.
* fixes out of date README instructions for MSRV.
* bumps the ci `build_docs` job to rust `nightly-2024-05-12`.
### Changelog notice
Changed
- Update Wallet to use CombinedChangeSet for persistence.
Added
- Add CombinedChangeSet in bdk_persist crate.
- Add bdk_sqlite crate implementing SQLite based PersistenceBackend storage for CombinedChangeSet.
### Checklists
#### All Submissions:
* [x] I've signed all my commits
* [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
* [x] I ran `cargo fmt` and `cargo clippy` before committing
#### New Features:
* [x] I've added tests for the new feature
* [x] I've added docs for the new feature
ACKs for top commit:
evanlinjin:
ACK 475c5024ecc5d288f35fabb8fab2b62dbf67653b
Tree-SHA512: 72565127994fbfff34d7359e1d36d6f13e552995bb7ea61dd38ba5329b0d15e500fa106214a83fd870f1017dc659ff1bb8fc71bc6aad0a793730ec7f23179d8c
It is a good idea to have common changeset types stored in
`bdk_persist`. This will make it convenient for persistence crates and
`bdk_wallet` interaction.
af15ebba94f6d96a4d266fbbdee7c49150f80b96 fix(electrum): Fix `fetch_prev_txout` (valued mammal)
Pull request description:
Previously we inserted every `TxOut` of a previous tx at the same outpoint, which is incorrect because an outpoint only points to a single `TxOut`. Now just get the `TxOut` corresponding to the txin prevout and insert it with its outpoint.
### Notes to the reviewers
The bug in question was demonstrated in a discord comment https://discord.com/channels/753336465005608961/1239693193159639073/1239704153400414298 but I don't think we've opened an issue yet. Essentially, because of a mismatch between the outpoint and txout stored in TxGraph, we weren't summing the inputs correctly which caused `calculate_fee` to fail with `NegativeFee` error.
fixes#1419
### Checklists
#### All Submissions:
* [x] I've signed all my commits
* [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
* [x] I ran `cargo fmt` and `cargo clippy` before committing
#### Bugfixes:
* [ ] I've added tests to reproduce the issue which are now passing
ACKs for top commit:
LagginTimes:
ACK af15ebba94f6d96a4d266fbbdee7c49150f80b96
evanlinjin:
ACK af15ebba94f6d96a4d266fbbdee7c49150f80b96
Tree-SHA512: c3a2c374069b0863076784856d90c7760b8f411e4881c3e42367015542b02ea6010c37745fb6dde95422af7222b7939ec51bc0fd1f63f816813c2159a17e08e5
Previously we inserted every TxOut of a previous tx
at the same outpoint, which is incorrect because an outpoint
only points to a single TxOut. Now just get the TxOut
corresponding to the txin prevout and insert it with
its outpoint.
f6781652b7a4833b220e0853cd6e290bb5fc0136 chore: rename bdk crate to bdk_wallet (Steve Myers)
Pull request description:
### Description
Fixes#1305 .
### Notes to the reviewers
Once this properly builds, even before all reviews is done, I will publish it to crates.io to reserve the name.
### Changelog notice
Changed
- Renamed `bdk` crate to `bdk_wallet`.
### Checklists
#### All Submissions:
* [x] I've signed all my commits
* [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
* [x] I ran `cargo fmt` and `cargo clippy` before committing
Top commit has no ACKs.
Tree-SHA512: 437c79d9d41721bc9cffd3be81e898068378803dcde6b4106d33bf34ffa756d090dce36d15d4ecd232e5b55ce09c393e6956fc0af4b8477886dabb506b679256
db9fdccc18c418cbbdf39ef4e912416796d63860 Bump bdk version to 1.0.0-alpha.11 (Steve Myers)
Pull request description:
### Description
fixes#1435
bdk_chain to 0.14.0
bdk_bitcoind_rpc to 0.10.0
bdk_electrum to 0.13.0
bdk_esplora to 0.13.0
bdk_file_store to 0.11.0
bdk_testenv to 0.4.0
bdk_persist to 0.2.0
### Checklists
#### All Submissions:
* [x] I've signed all my commits
* [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
* [x] I ran `cargo fmt` and `cargo clippy` before committing
ACKs for top commit:
ValuedMammal:
ACK db9fdccc18c418cbbdf39ef4e912416796d63860
storopoli:
ACK db9fdccc18c418cbbdf39ef4e912416796d63860
Tree-SHA512: 804475927461a4bcf37786313123a0a0cc68390af6c556111551dc126a06614296eb657a8a5662a36cf4569ab332f5f9285c99c5f1992d93f43568e881961895
bdk_chain to 0.14.0
bdk_bitcoind_rpc to 0.10.0
bdk_electrum to 0.13.0
bdk_esplora to 0.13.0
bdk_file_store to 0.11.0
bdk_testenv to 0.4.0
bdk_persist to 0.2.0
b45897e6fe2f7e67f5d75ec6f983757b28c5ec19 feat(electrum): update docs and simplify logic of `ElectrumExt` (志宇)
92fb6cb37387fb0b9fe5329e772f0d928a33e116 chore(electrum): do not use `anyhow::Result` directly (志宇)
b2f3cacce6081f3bf6e103d1d2ca0707c545a67e feat(electrum): include option for previous `TxOut`s for fee calculation (Wei Chen)
c0d7d60a582b939324bb48ec8c5035020ec90699 feat(chain)!: use custom return types for `ElectrumExt` methods (志宇)
2945c6be88b3bf5105afeb8addff4861f0458b41 fix(electrum): fixed `sync` functionality (Wei Chen)
9ed33c25ea01278b0a47c8ecd5ea6fa33119a977 docs(electrum): fixed `full_scan`, `sync`, and crate documentation (Wei Chen)
b1f861b932afd5e490c0814b1921b97cc2f1d912 feat: update logging of electrum examples (志宇)
a6fdfb2ae4caa1cdd23aa5e5ffaf02716473a98e feat(electrum)!: use new sync/full-scan structs for `ElectrumExt` (志宇)
653e4fed6d16698bc5859c1e4afdcee7b3d83dad feat(wallet): cache txs when constructing full-scan/sync requests (志宇)
58f27b38eb2093bb9b715b7e0ebd1619ecad74ee feat(chain): introduce `TxCache` to `SyncRequest` and `FullScanRequest` (志宇)
721bb7f519131ca295a00efa2d242b4923e2bddd fix(chain): Make `Anchor` type in `FullScanResult` generic (志宇)
e3cfb84898cfa79d4903cf276fc69ffb0605b4d4 feat(chain): `TxGraph::insert_tx` reuses `Arc` (志宇)
2ffb65618afb7382232a3c08a077dd1109005071 refactor(electrum): remove `RelevantTxids` and track txs in `TxGraph` (Wei Chen)
Pull request description:
Fixes#1265
Possibly fixes#1419
### Context
Previous changes such as
* Universal structures for full-scan/sync (PR #1413)
* Making `CheckPoint` linked list query-able (PR #1369)
* Making `Transaction`s cheaply-clonable (PR #1373)
has allowed us to simplify the interaction between chain-source and receiving-structures (`bdk_chain`).
The motivation is to accomplish something like this ([as mentioned here](https://github.com/bitcoindevkit/bdk/issues/1153#issuecomment-1752263555)):
```rust
let things_I_am_interested_in = wallet.lock().unwrap().start_sync();
let update = electrum_or_esplora.sync(things_i_am_interested_in)?;
wallet.lock().unwrap().apply_update(update)?:
```
### Description
This PR greatly simplifies the API of our Electrum chain-source (`bdk_electrum`) by making use of the aforementioned changes. Instead of referring back to the receiving `TxGraph` mid-sync/scan to determine which full transaction to fetch, we provide the Electrum chain-source already-fetched full transactions to start sync/scan (this is cheap, as transactions are wrapped in `Arc`s since #1373).
In addition, an option has been added to include the previous `TxOut` for transactions received from an external wallet for fee calculation.
### Changelog notice
* Change `TxGraph::insert_tx` to take in anything that satisfies `Into<Arc<Transaction>>`. This allows us to reuse the `Arc` pointer of what is being inserted.
* Add `tx_cache` field to `SyncRequest` and `FullScanRequest`.
* Make `Anchor` type in `FullScanResult` generic for more flexibility.
* Change `ElectrumExt` methods to take in `SyncRequest`/`FullScanRequest` and return `SyncResult`/`FullScanResult`. Also update electrum examples accordingly.
* Add `ElectrumResultExt` trait which allows us to convert the update `TxGraph` of `SyncResult`/`FullScanResult` for `bdk_electrum`.
* Added an option for `full_scan` and `sync` to also fetch previous `TxOut`s to allow for fee calculation.
### Checklists
#### All Submissions:
* [x] I've signed all my commits
* [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
* [x] I ran `cargo fmt` and `cargo clippy` before committing
#### New Features:
* [x] I've added tests for the new feature
* [x] I've added docs for the new feature
ACKs for top commit:
ValuedMammal:
ACK b45897e6fe2f7e67f5d75ec6f983757b28c5ec19
notmandatory:
ACK b45897e6fe2f7e67f5d75ec6f983757b28c5ec19
Tree-SHA512: 1e274546015e7c7257965b36079ffe0cb3c2c0b7c2e0c322bcf32a06925a0c3e1119da1c8fd5318f1dbd82c2e952f6a07f227a9b023c48f506a62c93045d96d3
Helper method docs are updated to explain what they are updating. Logic
is simplified as we do not need to check whether a tx exists already in
`update_graph` before inserting it.
The previous `TxOut` for transactions received from an external
wallet may be optionally added as floating `TxOut`s to `TxGraph`
to allow for fee calculation.