]> Untitled Git - bdk/log
bdk
15 months agorefactor(wallet)!: remove dangling unused `hardwaresigner.rs` file
Leonardo Lima [Fri, 16 Aug 2024 00:41:29 +0000 (21:41 -0300)]
refactor(wallet)!: remove dangling unused `hardwaresigner.rs` file

It seems this file was left out on the previous migration from hardware
signers from `bdk_wallet` crate to the `bdk_hwi`, but it should've been
removed.

15 months agoMerge bitcoindevkit/bdk#1597: fix(wallet): do `check_wallet_descriptor` when creating...
Steve Myers [Wed, 11 Sep 2024 14:19:51 +0000 (09:19 -0500)]
Merge bitcoindevkit/bdk#1597: fix(wallet): do `check_wallet_descriptor` when creating and loading

5aecf4d6c48b75e610bbb9e31ad552878d797b5c fix(wallet): do `check_wallet_descriptor` when creating and loading (valued mammal)

Pull request description:

  Do `check_wallet_descriptor` for both external and internal descriptors when creating a wallet, and as a defensive measure also perform the check on the descriptors loaded from a changeset.

  fixes #1557

  ### 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:
    ACK 5aecf4d6c48b75e610bbb9e31ad552878d797b5c

Tree-SHA512: c1503cc0350894cff762925276a2b5b94ac07155df8ff85c9277fb33001bc3137f479f1b8b1c5da4401a6a1b7184467915558e1fa761ae7ccef5d8886103cdad

15 months agoMerge bitcoindevkit/bdk#1599: fix: typos
Steve Myers [Wed, 11 Sep 2024 14:09:58 +0000 (09:09 -0500)]
Merge bitcoindevkit/bdk#1599: fix: typos

bc83e41126b75c32374a4fa6ba054c114ee62704 fix: typos (Jose Storopoli)

Pull request description:

  <!-- You can erase any parts of this template not applicable to your Pull Request. -->

  ### Description

  more typos caught up during rebasing of #1320.

  ### Notes to the reviewers

  ### Changelog notice

  <!-- 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:
  LagginTimes:
    ACK bc83e41126b75c32374a4fa6ba054c114ee62704
  oleonardolima:
    ACK bc83e41126b75c32374a4fa6ba054c114ee62704
  thunderbiscuit:
    ACK bc83e41126b75c32374a4fa6ba054c114ee62704.

Tree-SHA512: 1dc76d64ddb0273c60899a6617dcbc63fab75057447080260b7050bb5d178ef56c6f79f2c7f1ca5b7b4eb09e2b1e67d782be91598ab58e6a3b3179d6b5edf5c5

15 months agofix: typos
Jose Storopoli [Tue, 10 Sep 2024 09:51:36 +0000 (09:51 +0000)]
fix: typos

15 months agoMerge bitcoindevkit/bdk#1586: Change methods of `IndexedTxGraph`/`TxGraph`/`Wallet...
Steve Myers [Mon, 9 Sep 2024 19:58:20 +0000 (14:58 -0500)]
Merge bitcoindevkit/bdk#1586: Change methods of `IndexedTxGraph`/`TxGraph`/`Wallet` that insert txs to be more generic

87e61212f556bccfaa2a64b74f727cedc0f70e9c feat(chain,wallet)!: change methods to take in generic instead of `&Transaction` (志宇)
c39284d8299c5a8b34b73ce947e93425d5cdc121 feat(wallet): make `Wallet::insert_tx` generic (志宇)
67d5fa695f3f748d176c182d25be5ef70f5127ed feat(chain): make various insert tx methods more generic (志宇)

Pull request description:

  ### Description

  We want to reuse the `Arc` pointer whenever possible. However, some methods on `TxGraph` and `IndexedTxGraph` that insert transactions take in `&Transaction` or `Transaction` (thus forcing us to create a new `Arc<Transaction>` internally by cloning, even if the input tx is under a `Arc`).

  This PR changes these methods to take in a generic parameter, `T: Into<Arc<Transaction>>`, allowing us to reuse the `Arc` pointer whenever possible.

  ### Notes to the reviewers

  Methods that previously took in `Transaction` can be changed to take in `T: Into<Arc<Transaction>>` and be non-breaking (since `Arc<T>` impls `From<T>` automatically). These changes are contained in the first two commits.

  Methods that previously took in `&Transaction` will break. However, I think these api changes are small and the improvements are substantial enough to be worth it. These changes are contained in the last commit.

  ### Changelog notice

  * Changed `IndexedTxGraph` methods `insert_tx`, `batch_insert_relevant`, `batch_insert_relevant_unconfirmed`, `batch_insert_unconfirmed` to take in `T: Into<Arc<Transaction>>` instead of `Transaction` or `&Transaction`.
  * Changed `TxGraph` method `batch_insert_unconfirmed` to take in `T: Into<Arc<Transaction>>` instead of `Transaction`.
  * Changed `Wallet` methods `insert_tx`, `apply_unconfirmed_txs` to take in `T: Into<Arc<Transaction>>` instead of `Transaction` or `&Transaction`.

  ### 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:
  oleonardolima:
    utACK 87e61212f556bccfaa2a64b74f727cedc0f70e9c
  notmandatory:
    ACK 87e61212f556bccfaa2a64b74f727cedc0f70e9c

Tree-SHA512: 6be8cde80984caaaf544fa5738bc4de39428cd4cd352d242ecb73d7cf2e69794c869249e76653a32a47bb5d19e4b3a47036e063cdd32ad47642b44c99cb7ee7c

15 months agoMerge bitcoindevkit/bdk#1595: refactor(wallet): use `Amount` everywhere
Steve Myers [Mon, 9 Sep 2024 19:34:00 +0000 (14:34 -0500)]
Merge bitcoindevkit/bdk#1595: refactor(wallet): use `Amount` everywhere

292ec3cb3a41d7b9f42cfea536c39b27dba16d4c refactor(wallet): use `Amount` everywhere (valued mammal)

Pull request description:

  This is a followup to #1426 that refactors wallet internals to use `bitcoin::Amount` (nearly) everywhere. I chose not to change any public types in `coin_selection.rs` that still use `u64` as that might require more discussion.

  partially addresses #1432
  fixes #1434

  ### 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:
  oleonardolima:
    ACK 292ec3cb3a41d7b9f42cfea536c39b27dba16d4c
  notmandatory:
    ACK 292ec3cb3a41d7b9f42cfea536c39b27dba16d4c

Tree-SHA512: e84c543e796e151803321ad238023bd5f446448b4430dd6c62929180d159ee1ef867e98f69a4ef3b152c3146b8e30bbf01ce7952ac00b726847a224dca7e3be4

15 months agoMerge bitcoindevkit/bdk#1579: fix(wallet): only mark change address used if `create_t...
Steve Myers [Mon, 9 Sep 2024 16:31:42 +0000 (11:31 -0500)]
Merge bitcoindevkit/bdk#1579: fix(wallet): only mark change address used if `create_tx` succeeds

606fa0874db0f10cd1c64de0f1f097b12db3a16d ci: bump actions/upload-artifact to v4 (valued mammal)
75989d8cde3902f226bfa89aae05803b93a7cf1d test(wallet): Add `test_create_tx_increment_change_index` (valued mammal)
b60d1d29cb8908c354b43c49237acbea373c3dc7 fix(wallet): only mark change address used if `create_tx` succeeds (valued mammal)

Pull request description:

  If no drain script is specified in tx params then we get it from the change keychain by looking at the next unused address. Before this PR we marked the index used regardless of whether a change output is finally added. Then if creating a psbt failed, we never restored the unused status of the change address, so creating the next tx would have revealed an extra one.

  We want to mark the change address used so that other callers won't attempt to use the same address between the time we create the tx and when it appears on chain. With this PR we only mark the change address used if we successfully create a psbt and the drain script is used in the change output.

  fixes #1578

  ### Notes to the reviewers

  An early idea was to unmark the change address used if we fail to create a tx due to `InsufficientFunds`, but after looking into it I figure it doesn't totally make sense to mark the address used before we've determined that a change output is necessary. Further, `create_tx` can fail in other ways besides running coin selection, so I moved the `mark_used` logic to the end of the function.

  ### Changelog notice

  Fixed an issue that caused an unused internal address to be skipped when creating transactions (#1578)

  ### 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] 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 606fa0874db0f10cd1c64de0f1f097b12db3a16d

Tree-SHA512: 4715494d901efccff38d636f0538f193ff32db1de44f8d56a98bb0136483f3a8ce1315901bb98117d6870d5b7e4a3bdf3d208f005e2adc0b29625f84a9e8974e

15 months agoci: bump actions/upload-artifact to v4
valued mammal [Mon, 9 Sep 2024 15:51:11 +0000 (11:51 -0400)]
ci: bump actions/upload-artifact to v4

15 months agotest(wallet): Add `test_create_tx_increment_change_index`
valued mammal [Tue, 27 Aug 2024 16:24:41 +0000 (12:24 -0400)]
test(wallet): Add `test_create_tx_increment_change_index`

15 months agofix(wallet): only mark change address used if `create_tx` succeeds
valued mammal [Tue, 27 Aug 2024 15:54:25 +0000 (11:54 -0400)]
fix(wallet): only mark change address used if `create_tx` succeeds

If no drain script is specified in tx params then we get it from
the change keychain by looking at the next unused address. We want
to mark the change address used so that other callers won't attempt
to use the same address between the time we create the tx and when
it appears on chain.

Before, we marked the index used regardless of whether a change
output is finally added. Then if creating a PSBT failed, we never
restored the unused status of the change address, so creating the
next tx would have revealed an extra one. Now we only mark the change
address used if we successfully create a PSBT and the drain script
is used in the change output.

15 months agofix(wallet): do `check_wallet_descriptor` when creating and loading
valued mammal [Sat, 31 Aug 2024 17:02:25 +0000 (13:02 -0400)]
fix(wallet): do `check_wallet_descriptor` when creating and loading

15 months agorefactor(wallet): use `Amount` everywhere
valued mammal [Sat, 7 Sep 2024 23:21:04 +0000 (19:21 -0400)]
refactor(wallet): use `Amount` everywhere

15 months agoMerge bitcoindevkit/bdk#1584: docs: update CONTRIBUTING.md
Steve Myers [Thu, 5 Sep 2024 17:30:44 +0000 (12:30 -0500)]
Merge bitcoindevkit/bdk#1584: docs: update CONTRIBUTING.md

6b881f8ab46bd0f3c612e522df21dc48ae5e6955 docs: update CONTRIBUTING.md (valued mammal)

Pull request description:

  Update `CONTRIBUTING.md`

  * Made small corrections and added some things that were missing. If there's something else you think should be included let me know.

  closes #1394

  ### Changelog notice

  ### 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)

ACKs for top commit:
  LagginTimes:
    ACK 6b881f8ab46bd0f3c612e522df21dc48ae5e6955
  notmandatory:
    ACK 6b881f8ab46bd0f3c612e522df21dc48ae5e6955
  storopoli:
    ACK 6b881f8ab46bd0f3c612e522df21dc48ae5e6955
  oleonardolima:
    ACK 6b881f8ab46bd0f3c612e522df21dc48ae5e6955

Tree-SHA512: 9a000cb86800e8dac582e2bab06613c28111268fa343d8621181e8bf1b4859029704d1258392248449c36af9dd5ecf8ab25dadfe5bcf62e40e10719a575d3b64

15 months agoMerge bitcoindevkit/bdk#1477: feat(wallet): add transactions_sort_by function
Steve Myers [Thu, 5 Sep 2024 05:03:05 +0000 (00:03 -0500)]
Merge bitcoindevkit/bdk#1477: feat(wallet): add transactions_sort_by function

83a0247e8ea6afd8329af5dd9b28f9892bd5e9c1 feat(wallet): add transactions_sort_by function (Steve Myers)

Pull request description:

  ### Description

  Added new type alias `WalletTx` which represents a `CanonicalTx<'a, Arc<Transaction>, ConfirmationTimeHeightAnchor>` and new `Wallet::transactions_sort_by` that returns a `Vec<WalletTx>` sorted by the given compare function.

  ### Notes to the reviewers

  fixes #794

  ### Changelog notice

  * Add new type alias `WalletTx` which represents a `CanonicalTx<'a, Arc<Transaction>, ConfirmationTimeHeightAnchor>`.
  * Add `Wallet::transactions_sort_by()` that returns a `Vec<WalletTx>` sorted by a given compare 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

  #### New Features:

  * [x] I've added tests for the new feature
  * [x] I've added docs for the new feature

Top commit has no ACKs.

Tree-SHA512: 5758b5edf8200b5534b7a7f538de640e85083bed3da2585109190f0efda3e238f5483d4a2dc073dc4b907644f58b7158a922ebe09d03a47201030162d4b0f4d3

15 months agofeat(wallet): add transactions_sort_by function
Steve Myers [Tue, 18 Jun 2024 01:48:03 +0000 (20:48 -0500)]
feat(wallet): add transactions_sort_by function

Added type WalletTx<'a> as an alias for CanonicalTx<'a, Arc<Transaction>, ConfirmationBlockTime>.

15 months agoMerge bitcoindevkit/bdk#1590: ci: pin `tokio-util` dependency version to build with...
merge-script [Thu, 5 Sep 2024 04:06:44 +0000 (12:06 +0800)]
Merge bitcoindevkit/bdk#1590: ci: pin `tokio-util` dependency version to build with rust 1.63

ea6876b70eb2b1ca9ee73e5719f1a9850e11827c ci: pin `tokio-util` dependency version to build with rust 1.63 (Wei Chen)

Pull request description:

  <!-- You can erase any parts of this template not applicable to your Pull Request. -->

  ### Description

  <!-- Describe the purpose of this PR, what's being adding and/or fixed -->
  `tokio-util` version 0.7.12 raised `msrv` to 1.70.
  The previous version 0.7.11 was pinned to CI to continue working.

  ### Notes to the reviewers

  <!-- 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

  <!-- Notice the release manager should include in the release tag message changelog -->
  <!-- See https://keepachangelog.com/en/1.0.0/ for examples -->
  * Pinned tokio-util dependency version to build with rust 1.63.

  ### 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 ea6876b70eb2b1ca9ee73e5719f1a9850e11827c

Tree-SHA512: f200dc753fabe993bf926506e213d16050808b00eeb9c2d36fbd45cb62e0611300c660839ea37e17b0513cba2a5da48321e186d173d2871b45d2fce266f4f2b0

16 months agoci: pin `tokio-util` dependency version to build with rust 1.63
Wei Chen [Thu, 5 Sep 2024 03:50:48 +0000 (11:50 +0800)]
ci: pin `tokio-util` dependency version to build with rust 1.63

16 months agoMerge pull request #1587 from evanlinjin/tx_update_map_anchors
Lloyd Fournier [Wed, 4 Sep 2024 23:14:44 +0000 (09:14 +1000)]
Merge pull request #1587 from evanlinjin/tx_update_map_anchors

feat(core): add `TxUpdate::map_anchors`

16 months agofeat(core): add `TxUpdate::map_anchors`
志宇 [Tue, 3 Sep 2024 07:28:27 +0000 (15:28 +0800)]
feat(core): add `TxUpdate::map_anchors`

16 months agofeat(chain,wallet)!: change methods to take in generic instead of `&Transaction`
志宇 [Mon, 2 Sep 2024 09:59:09 +0000 (17:59 +0800)]
feat(chain,wallet)!: change methods to take in generic instead of `&Transaction`

* `Wallet::apply_unconfirmed_txs`
* `IndexedTxGraph::batch_insert_relevant`
* `IndexedTxGraph::batch_insert_relevant_unconfirmed`

16 months agofeat(wallet): make `Wallet::insert_tx` generic
志宇 [Tue, 3 Sep 2024 05:18:20 +0000 (13:18 +0800)]
feat(wallet): make `Wallet::insert_tx` generic

Instead of having `Transaction` as input, have
`T: Into<Arc<Transaction>>`.

16 months agofeat(chain): make various insert tx methods more generic
志宇 [Mon, 2 Sep 2024 09:32:19 +0000 (17:32 +0800)]
feat(chain): make various insert tx methods more generic

Instead of having `Transaction` as input, we have a generic parameter
where the bound is `Into<Arc<Transaction>>` for the following methods:

* `IndexedTxGraph::insert_tx`
* `IndexedTxGraph::batch_insert_unconfirmed`
* `TxGraph::batch_insert_unconfirmed`

16 months agodocs: update CONTRIBUTING.md
valued mammal [Fri, 30 Aug 2024 18:09:33 +0000 (14:09 -0400)]
docs: update CONTRIBUTING.md

16 months agoMerge bitcoindevkit/bdk#1580: ci: add token for cron-update-rust.yml
Steve Myers [Fri, 30 Aug 2024 15:27:00 +0000 (10:27 -0500)]
Merge bitcoindevkit/bdk#1580: ci: add token for cron-update-rust.yml

b140b32648241884e0e5e222fd7a0fc4e05908f1 ci: gpg commit signing for cron-update-rust.yml (Steve Myers)
054d1483bb19e8415745033853ae0fa6943f01d9 ci: add token for cron-update-rust.yml (Steve Myers)

Pull request description:

  ### Description

  Add organization app token and GPG signing key for cron-update-rust.yml.

  ### Notes to the reviewers

  I went with the organization github app token option mentioned here:
  https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#triggering-further-workflow-runs

  I added gpg commit signing with below instructions. The instructions say to use PAT for signing but the plugin doesn't mention it's needed so I want to try it with only the github app token.
  https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#gpg-commit-signature-verification

ACKs for top commit:
  oleonardolima:
    ACK b140b32648241884e0e5e222fd7a0fc4e05908f1
  ValuedMammal:
    ACK b140b32648241884e0e5e222fd7a0fc4e05908f1

Tree-SHA512: 0730264ccd39645bbfe496abb43e5ac4c16de1ca9032ede4310ec190c4441152fa8adef09cf73c28c9b547d0de41e34431df88deba7d706389df564907081583

16 months agoMerge bitcoindevkit/bdk#1425: chore: add `print_stdout`/`print_stderr` lints to works...
Steve Myers [Thu, 29 Aug 2024 14:49:39 +0000 (09:49 -0500)]
Merge bitcoindevkit/bdk#1425: chore: add `print_stdout`/`print_stderr` lints to workspace level

e063ad89bde62e60b10435260e736c66515bf447 fix(esplora+wallet+file_store): remove remaining `println!` usage (Leonardo Lima)
b32b9447e089709b66f24d5700750f0aa6b8d6e1 chore(examples): allow `clippy::print_stdout` in examples (Leonardo Lima)
b614237127ec1e760414fcc8ee7c4b0c77c62d46 fix(tests)!: remove println! usage from tests (Leonardo Lima)
eaa1917a46245e177ad3e65b53e34c681f0043d0 chore: add `print_stdout`/`print_stderr` lints to workspace level (Leonardo Lima)

Pull request description:

  potentially fixes #1362
  <!-- You can erase any parts of this template not applicable to your Pull Request. -->

  ### Description

  It adds both `print_stdout` and `print_stderr` deny level lints on workspace level, but it does allow it on test fns through `clippy.toml` settings, and explicitly allow it on example code.

  <!-- Describe the purpose of this PR, what's being adding and/or fixed -->

  ### Notes to the reviewers
  It currently has the setting allowing it on test fns, but open for discussion below.

  <!-- 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

  - Add both `print_stdout` and `print_stderr` deny level lints on workspace level

  <!-- 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:
  notmandatory:
    ACK e063ad89bde62e60b10435260e736c66515bf447

Tree-SHA512: b3348efd86d09944eb36e4d87799eebc23f4e423861b3bad08365d286449f61b29ad332157eecfb7307191ef61d3b8285341e0ccb868581e54b570d6dd37547c

16 months agoci: gpg commit signing for cron-update-rust.yml
Steve Myers [Wed, 28 Aug 2024 04:54:01 +0000 (23:54 -0500)]
ci: gpg commit signing for cron-update-rust.yml

16 months agoci: add token for cron-update-rust.yml
Steve Myers [Wed, 28 Aug 2024 04:07:48 +0000 (23:07 -0500)]
ci: add token for cron-update-rust.yml

16 months agoMerge bitcoindevkit/bdk#1573: chore: add missing bdk_core README.md and remove specif... v1.0.0-beta.2
Steve Myers [Sun, 25 Aug 2024 17:56:49 +0000 (12:56 -0500)]
Merge bitcoindevkit/bdk#1573: chore: add missing bdk_core README.md and remove specific bdk_chain dev version

48b6a66f6e0edce305d41653f37b8549aaf7c060 chore(core): remove bdk_chain dev-dependency version (Steve Myers)
9bd500f5f198df4dfc72a1f71c93f9b20d65431d chore(core): add missing README.md (Steve Myers)

Pull request description:

  Add the missing README.md file for the bdk_core crate. This is required to publish to crates.io.

  Also had to removed fixed bdk_chain version from bdk_core dev dependencies to prevent missing dependency when publishing bdk_core before publishing new version of bdk_chain.

ACKs for top commit:
  ValuedMammal:
    ACK 48b6a66f6e0edce305d41653f37b8549aaf7c060

Tree-SHA512: 5fb31984f79771c5366ca078efa11330b24fd4d97e90531a2ba8f92ce6361c6dd4f123e8640269de9235bc5ebf3e6b5ced261e36f5b40f01db3f82add9a5ae68

16 months agochore(core): remove bdk_chain dev-dependency version
Steve Myers [Sun, 25 Aug 2024 17:25:23 +0000 (12:25 -0500)]
chore(core): remove bdk_chain dev-dependency version

16 months agochore(core): add missing README.md
Steve Myers [Sun, 25 Aug 2024 17:19:36 +0000 (12:19 -0500)]
chore(core): add missing README.md

16 months agoMerge bitcoindevkit/bdk#1572: Bump bdk version to 1.0.0-beta.2
Steve Myers [Sun, 25 Aug 2024 16:01:16 +0000 (11:01 -0500)]
Merge bitcoindevkit/bdk#1572: Bump bdk version to 1.0.0-beta.2

092e9be454b3f1f4754f3fefb70b203d7e86c423 Bump bdk version to 1.0.0-beta.2 (Steve Myers)

Pull request description:

  Bump versions for bdk 1.0.0-beta.2 release:

  bdk version to 1.0.0-beta.2
  bdk_chain to 0.18.0
  bdk_bitcoind_rpc to 0.14.0
  bdk_electrum to 0.17.0
  bdk_esplora to 0.17.0
  bdk_file_store to 0.15.0
  bdk_testenv to 0.8.0
  bdk_hwi to 0.5.0

ACKs for top commit:
  ValuedMammal:
    ACK 092e9be454b3f1f4754f3fefb70b203d7e86c423

Tree-SHA512: 39f5cb6efd413ac5efc1736176bf846a727f22f2dcabcae97e726f6793e0b8586358193531aca9118f141e313f21a3f63b6b3ed13343df40940d8435ab6264f3

16 months agoBump bdk version to 1.0.0-beta.2
Steve Myers [Sun, 25 Aug 2024 15:13:59 +0000 (10:13 -0500)]
Bump bdk version to 1.0.0-beta.2

bdk_chain to 0.18.0
bdk_bitcoind_rpc to 0.14.0
bdk_electrum to 0.17.0
bdk_esplora to 0.17.0
bdk_file_store to 0.15.0
bdk_testenv to 0.8.0
bdk_hwi to 0.5.0

16 months agoMerge bitcoindevkit/bdk#1569: Introduce `bdk_core`
志宇 [Sun, 25 Aug 2024 13:34:02 +0000 (13:34 +0000)]
Merge bitcoindevkit/bdk#1569: Introduce `bdk_core`

a5d076f215cd91173f55bda0d1cc59b9dde75511 chore(core)!: s/tx_graph::Update/TxUpdate/ (LLFourn)
dafb9aaef7d8d4bc83c8ba0845323b92b82fbb3d feat(bitcoind_rpc)!: depend on `bdk_core` instead of `bdk_chain` (志宇)
fea8eede760130db32c2cfaecc272f6c1ed979db feat(esplora)!: depend on `bdk_core` instead of `bdk_chain` (志宇)
0d302f5f204eeac8902a4b5943b9b820c6b575ab feat(electrum)!: depend on `bdk_core` instead of `bdk_chain` (志宇)
ab0315d14fa741a691ee0deef4567ea66cb44a60 feat!: move `spk_client`s to `bdk_core` (志宇)
bdea871a0d0d337772f226fdcf5cd734f3d857ba feat!: move `tx_graph::Update` to `bdk_core` (志宇)
77e31c71a5edc011df42daece1920903bc2b866f feat!: move `CheckPoint` to `bdk_core` (志宇)
a86c878a60f40ce30ab00c0b47fa6cddf30cfe30 refactor(chain): change `CheckPoint::apply_changeset` (志宇)
6f7626ad0bb6ca7e45428af11dbf930d746d9cd0 feat!: introduce `bdk_core` (志宇)

Pull request description:

  Based on #1568
  Closes #1543

  ### Description

  Introduce `bdk_core` crate. Move types over from `bdk_chain`. Chain sources (`bdk_electrum`, `bdk_esplora` and `bdk_bitcoind_rpc`) now only depend on `bdk_core`.

  ### Notes to the reviewers

  Please review commit-by-commit. I've moved things over, but slight API changes were necessary (mentioned in the commit messages).

  ### Changelog notice

  * Add `bdk_core` crate which contains core types that were previously in `bdk_chain`. Including: `BlockId`, `ConfirmationBlockTime`, `CheckPoint`, `CheckPointIter`, `tx_graph::Update` and `spk_client`-types.
  * Change chain sources (`bdk_esplora`, `bdk_electrum` and `bdk_bitcoind_rpc`) to only depend on `bdk_core`.

  ### 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:
  LLFourn:
    Self-ACK: a5d076f215cd91173f55bda0d1cc59b9dde75511
  evanlinjin:
    ACK a5d076f215cd91173f55bda0d1cc59b9dde75511

Tree-SHA512: 13ecd0a2d2fc840b281977f07dc11fed27459f77c676af470134d2184db4a1fc352073ef82b1622e04fc60edb885e587ae8b9909c9bafb4ae63fcd51325d1cad

16 months agochore(core)!: s/tx_graph::Update/TxUpdate/
LLFourn [Sun, 25 Aug 2024 05:35:18 +0000 (15:35 +1000)]
chore(core)!: s/tx_graph::Update/TxUpdate/

We shouldn't refer to `tx_graph` in `bdk_core`. TxGraph happens to
consume `Update` but it doesn't conceptually own the definition of an
update to transactions.

I tried to also remove a lot of references to "graph" where they
shouldn't be. "graph" is a very general kind of data structure so we
should avoid referring to it where it's not relevant. `tx_update` is
much better than `graph_update`.

16 months agoMerge pull request #1568 from evanlinjin/tx_graph_update
Lloyd Fournier [Sun, 25 Aug 2024 04:26:01 +0000 (14:26 +1000)]
Merge pull request #1568 from evanlinjin/tx_graph_update

Introduce `tx_graph::Update` and simplify `TxGraph` update logic

16 months agofeat(bitcoind_rpc)!: depend on `bdk_core` instead of `bdk_chain`
志宇 [Fri, 23 Aug 2024 18:38:55 +0000 (18:38 +0000)]
feat(bitcoind_rpc)!: depend on `bdk_core` instead of `bdk_chain`

16 months agofeat(esplora)!: depend on `bdk_core` instead of `bdk_chain`
志宇 [Fri, 23 Aug 2024 18:36:07 +0000 (18:36 +0000)]
feat(esplora)!: depend on `bdk_core` instead of `bdk_chain`

Helper methods have been changed to use concrete types (instead of
`A: Anchor` generic) - since `Anchor` is still part of `bdk_chain`.

Also fix esplora docs.

16 months agofeat(electrum)!: depend on `bdk_core` instead of `bdk_chain`
志宇 [Fri, 23 Aug 2024 18:26:28 +0000 (18:26 +0000)]
feat(electrum)!: depend on `bdk_core` instead of `bdk_chain`

`.populate_tx_cache` has been changed to take in a collection of
`Arc<Transaction>`.

16 months agofeat!: move `spk_client`s to `bdk_core`
志宇 [Fri, 23 Aug 2024 18:12:46 +0000 (18:12 +0000)]
feat!: move `spk_client`s to `bdk_core`

Also introduced extension trait for builder methods that take in a
`KeychainTxOutIndex`.

`Indexed<T>` and `KeychainIndexed<T>` are also moved to `bdk_core`.

16 months agofeat!: move `tx_graph::Update` to `bdk_core`
志宇 [Fri, 23 Aug 2024 16:57:59 +0000 (16:57 +0000)]
feat!: move `tx_graph::Update` to `bdk_core`

16 months agofeat!: move `CheckPoint` to `bdk_core`
志宇 [Fri, 23 Aug 2024 15:38:10 +0000 (15:38 +0000)]
feat!: move `CheckPoint` to `bdk_core`

Also add `CheckPoint::eq_ptr` which compares the internal pointers of
two `CheckPoint`s. This is used as an optimisation when comparing two
chains.

16 months agorefactor(chain): change `CheckPoint::apply_changeset`
志宇 [Fri, 23 Aug 2024 15:18:25 +0000 (15:18 +0000)]
refactor(chain): change `CheckPoint::apply_changeset`

to be a separate function: `apply_changeset_to_checkpoint`.

16 months agofeat!: introduce `bdk_core`
志宇 [Fri, 23 Aug 2024 15:08:55 +0000 (15:08 +0000)]
feat!: introduce `bdk_core`

This is an initial version with `chain_data` types ported over.

Types ported over include `BlockId`, `ConfirmationBlockTime`. The impls
for `Anchor` and `AnchorFromBlockPosition` of these types are moved to
where the traits are defined.

16 months agoMerge bitcoindevkit/bdk#1564: ci: add cron-update-rust.yml
Steve Myers [Fri, 23 Aug 2024 15:05:45 +0000 (10:05 -0500)]
Merge bitcoindevkit/bdk#1564: ci: add cron-update-rust.yml

b92f8c9ac1e000ccced89dc597a8ff278842d5ed ci: add cron-update-rust.yml (valued mammal)

Pull request description:

  This adds a cronjob to watch for updates to rust stable once a month. If the latest version changed, then a pull request is opened to see if clippy passes CI using the new toolchain.

  ### Notes to the reviewers

  Let me know what you think @notmandatory

  fixes #1431

  ### Changelog notice

  ### Checklists

  #### TODO

  * [ ] Setup access token for [create-pull-request](https://github.com/marketplace/actions/create-pull-request)

  #### 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:
  oleonardolima:
    tACK b92f8c9ac1e000ccced89dc597a8ff278842d5ed

Tree-SHA512: e251fb8d0456c30a244f4611131baea1afc4f8323a3bdc8d9536d276a8b4bb2c0269beba6b04b72ab2ea96897e421a16c3e8e6065a755d62ff98bfe13d0b02bd

16 months agotest(chain): `TxGraph` and `tx_graph::Update` conversion tests
志宇 [Fri, 23 Aug 2024 13:36:54 +0000 (13:36 +0000)]
test(chain): `TxGraph` and `tx_graph::Update` conversion tests

16 months agorevert(chain)!: rm `TxGraph::update_last_seen_unconfirmed`
志宇 [Fri, 23 Aug 2024 11:50:09 +0000 (11:50 +0000)]
revert(chain)!: rm `TxGraph::update_last_seen_unconfirmed`

This is no longer needed as `TxGraph::apply_update` now automatically
adds `seen_at` timestamps for unanchored transactions.

16 months agofeat(chain)!: `TxGraph::apply_update` auto-adds `seen_at` for unanchored
志宇 [Fri, 23 Aug 2024 09:53:42 +0000 (09:53 +0000)]
feat(chain)!: `TxGraph::apply_update` auto-adds `seen_at` for unanchored

Change `apply_update` to use the current timestamp as `seen_at` for
unanchored transactions of the update. This makes `apply_update` only
avaliable with the "std" feature.

Introduce `apply_update_at` which includes an optional `seen_at` input.
This is the no-std version of `apply_update`.

Also update docs.

16 months agodocs(chain): use `doc_cfg` feature
志宇 [Fri, 23 Aug 2024 12:14:42 +0000 (12:14 +0000)]
docs(chain): use `doc_cfg` feature

16 months agofeat!: introduce `tx_graph::Update`
志宇 [Fri, 23 Aug 2024 06:13:42 +0000 (06:13 +0000)]
feat!: introduce `tx_graph::Update`

Instead of updating a `TxGraph` with a `TxGraph`, we introduce a
dedicated data object (`tx_graph::Update`). This brings us closer to
completing #1543.

Co-authored-by: Wei Chen <wzc110@gmail.com>
16 months agoci: add cron-update-rust.yml
valued mammal [Wed, 21 Aug 2024 03:04:07 +0000 (23:04 -0400)]
ci: add cron-update-rust.yml

16 months agofeat(chain): get rid of `TxGraph::determine_changeset`
志宇 [Thu, 22 Aug 2024 08:39:08 +0000 (08:39 +0000)]
feat(chain): get rid of `TxGraph::determine_changeset`

Contain most of the insertion logic in `.insert_{}` methods, thus
simplifying `.apply_{}` methods. We can also get rid of
`.determine_changeset`.

16 months agoMerge bitcoindevkit/bdk#1562: fix(wallet)!: make `LoadParams` implicitly satisfy...
志宇 [Thu, 22 Aug 2024 06:47:48 +0000 (06:47 +0000)]
Merge bitcoindevkit/bdk#1562: fix(wallet)!: make `LoadParams` implicitly satisfy `Send`

295b9794caf142707c49666529268197694534e7 fix(wallet)!: make `LoadParams` implicitly satisfy `Send` (志宇)

Pull request description:

  ### Description

  Make `LoadParams` implicitly satisfy `Send`. This will hopefully make `AsyncWalletPersister` easier to implement.

  Refer to the [conversation on Discord](https://discord.com/channels/753336465005608961/753367451319926827/1273667818528964714).

  cc. @matthiasdebernardini

  ### Notes to the reviewers

  This is a breaking change, since we are tightening the bounds to some methods.

  ### Changelog notice

  * Change `LoadParams` to implicitly satisfy `Send`.

  ### 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:
  LLFourn:
    ACK 295b9794caf142707c49666529268197694534e7
  notmandatory:
    ACK 295b9794caf142707c49666529268197694534e7

Tree-SHA512: 952cd7fbb058166af93af0b8afa3e0f3c1afe600f5782364da8e3c74e7388ca682bab34e2c60b221055e25ade2f6ddb4a2e9451d6d181f14b0bcca053522155c

16 months agoMerge bitcoindevkit/bdk#1560: Derive `Clone` on `AddressInfo`
Steve Myers [Wed, 21 Aug 2024 18:16:45 +0000 (13:16 -0500)]
Merge bitcoindevkit/bdk#1560: Derive `Clone` on `AddressInfo`

b84292787f3b7291b79a1a096a9fc6e5ba33045c feat(wallet): Derive Clone on AddressInfo (Praveen Perera)

Pull request description:

  ### Description

  Derive `Clone` on `AddressInfo` so I can clone it

  ### 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

  ### Changelog notice

  * Added `Clone` impl for `AddessInfo`

ACKs for top commit:
  oleonardolima:
    ACK b84292787f3b7291b79a1a096a9fc6e5ba33045c
  evanlinjin:
    ACK b84292787f3b7291b79a1a096a9fc6e5ba33045c
  notmandatory:
    ACK b84292787f3b7291b79a1a096a9fc6e5ba33045c

Tree-SHA512: 56287730d74757ce8b1ec3fc8b9069da9ca2f95da80ce07a1cb4077cd9cc1da0a597b32d57eb2971f874865c125aec4a3313b373a613d338e8d1bdfb4e797851

16 months agofeat(wallet): Derive Clone on AddressInfo
Praveen Perera [Thu, 15 Aug 2024 16:22:37 +0000 (11:22 -0500)]
feat(wallet): Derive Clone on AddressInfo

16 months agoMerge bitcoindevkit/bdk#1547: Simplify wallet persistence
Steve Myers [Mon, 19 Aug 2024 15:49:57 +0000 (10:49 -0500)]
Merge bitcoindevkit/bdk#1547: Simplify wallet persistence

340808e820cc144c8b2756dd9c235fad1400ad76 docs(wallet): fixes/improvements for `persisted` and `params` types (志宇)
960029324d18dbb51408034efc05b0450867c15a feat(wallet)!: add persister (`P`) type param to `PersistedWallet<P>` (志宇)
06160574ba3997fa49449a251a8bc046fb1a96a5 revert(chain)!: rm `persit` module (志宇)
a9c5f761c4c6834f8a05f2eb64feb39d23b74c2a feat(wallet)!: remove dependency on `bdk_chain::Staged` (志宇)
06a9d6c722dd3e324d81ea5b9c2b65ab9f171a34 feat(chain,wallet)!: publicize `.init_sqlite_tables` changeset methods (志宇)
039622fd1de7ee331eceb7a4c77751bd8ecccda0 feat(wallet)!: introduce `WalletPersister` (志宇)

Pull request description:

  ### Description

  Removed the persistence module in `bdk_chain` (which contained the `PersistWith` and `PersistAsyncWith` traits and a `Persisted<T>` wrapper). Replaced it with simplified versions that are `Wallet`-specific.

  The new traits (`WalletPersister` and `AsyncWalletPersister`) are simpler since they have less type-parameters (being wallet-specific). The old versions were more complex as they were intended to be used with any type. However, we need more time to finalize a works-for-all-bdk-types persistence API.

  Additionally, `WalletPersister` and `AsyncWalletPersister` also introduce the `initialize` method. It is handy to contain db-initialization (i.e. create tables for SQL) here. We can call `initialize` in `PersistedWallet` constructors. So the `PersistedWallet::persist` method does not need to ensure the database is initialized. To accommodate this, I made the `.init_sqlite_table` methods on changeset-types public, and removed the call of this in `from_sqlite` and `.persist_to_sqlite`. The `initialize` method now loads from the persister, so the `load` associated function is removed.

  There was a bug in the old `PersistAsyncWith` trait where the lifetime bounds were not strict enough (refer to the conversation in #1552). This is now fixed in the new `AsyncWalletPersister` trait.

  Docs for the new types are clearer (hopefully). I mentioned implementation details about the new traits and what safety checks were guaranteed in `PersistedWallet`.

  I think it makes sense just to have a wallet-specific persistence API which we will maintain alongside wallet for v1.0. This is less baggage for users and maintainers alike.

  ### Notes to the reviewers

  **How breaking are these changes?**

  Unless if you were implementing your own persistence, then not breaking at all! If you were implementing your own persistence for BDK, the breakages are minimal. The main change is introducing the `initialize` method to persistence traits (which replaces `load`).

  **Acknowledgements**

  I came up with the idea of this while responding to @tnull's suggestions on Discord. Unfortunately we cannot fulfill all of his requests. However, I do believe that this will make things easier for our users.

  ### Changelog notice

  * Removed the `persist` module in `bdk_chain`.
  * Added `WalletPersister`/`AsyncWalletPersister` traits and `PersistedWallet` struct to `bdk_wallet`. These are simplified and safer versions of old structs provided by the `persist` module in `bdk_chain`.
  * Change `.init_sqlite_tables` method to be public on changeset types. `from_sqlite` and `persist_into_sqlite` methods no longer call `.init_sqlite_tables` internally.

  ### 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

  #### What is left to do:

  - [x] Better docs.

ACKs for top commit:
  notmandatory:
    ACK 340808e820cc144c8b2756dd9c235fad1400ad76

Tree-SHA512: 77643196543ad0a741f9ec51de4aad3893c6d608234ad6709c8688043bf1eef1e5e97e71681be0a6b29dec3fa255e2f0e63e08511c79ea4c0a6ef3286653d40c

16 months agodocs(wallet): fixes/improvements for `persisted` and `params` types
志宇 [Fri, 16 Aug 2024 04:11:20 +0000 (04:11 +0000)]
docs(wallet): fixes/improvements for `persisted` and `params` types

16 months agofix(wallet)!: make `LoadParams` implicitly satisfy `Send`
志宇 [Fri, 16 Aug 2024 04:21:33 +0000 (04:21 +0000)]
fix(wallet)!: make `LoadParams` implicitly satisfy `Send`

16 months agofix(esplora+wallet+file_store): remove remaining `println!` usage
Leonardo Lima [Thu, 15 Aug 2024 14:52:49 +0000 (11:52 -0300)]
fix(esplora+wallet+file_store): remove remaining `println!` usage

16 months agochore(examples): allow `clippy::print_stdout` in examples
Leonardo Lima [Thu, 15 Aug 2024 14:50:20 +0000 (11:50 -0300)]
chore(examples): allow `clippy::print_stdout` in examples

16 months agofix(tests)!: remove println! usage from tests
Leonardo Lima [Thu, 15 Aug 2024 14:46:29 +0000 (11:46 -0300)]
fix(tests)!: remove println! usage from tests

16 months agochore: add `print_stdout`/`print_stderr` lints to workspace level
Leonardo Lima [Sun, 5 May 2024 15:24:33 +0000 (12:24 -0300)]
chore: add `print_stdout`/`print_stderr` lints to workspace level

16 months agofeat(wallet)!: add persister (`P`) type param to `PersistedWallet<P>`
志宇 [Thu, 15 Aug 2024 05:49:18 +0000 (05:49 +0000)]
feat(wallet)!: add persister (`P`) type param to `PersistedWallet<P>`

This forces the caller to use the same persister type that they used for
loading/creating when calling `.persist` on `PersistedWallet`.

This is not totally fool-proof since we can have multiple instances of
the same persister type persisting to different databases. However, it
does further enforce some level of safety.

16 months agorevert(chain)!: rm `persit` module
志宇 [Sun, 11 Aug 2024 12:40:47 +0000 (12:40 +0000)]
revert(chain)!: rm `persit` module

16 months agofeat(wallet)!: remove dependency on `bdk_chain::Staged`
志宇 [Sun, 11 Aug 2024 09:28:53 +0000 (09:28 +0000)]
feat(wallet)!: remove dependency on `bdk_chain::Staged`

Introduce `Wallet::staged_mut` method.

16 months agofeat(chain,wallet)!: publicize `.init_sqlite_tables` changeset methods
志宇 [Sun, 11 Aug 2024 08:50:54 +0000 (08:50 +0000)]
feat(chain,wallet)!: publicize `.init_sqlite_tables` changeset methods

Changeset methods `.persist_to_sqlite` and `from_sqlite` no longer
internally call `.init_sqlite_tables`. Instead, it is up to the caller
to call `.init_sqlite_tables` beforehand.

This allows us to utilize `WalletPersister::initialize`, instead of
calling `.init_sqlite_tables` every time we persist/load.

16 months agofeat(wallet)!: introduce `WalletPersister`
志宇 [Fri, 9 Aug 2024 16:14:15 +0000 (16:14 +0000)]
feat(wallet)!: introduce `WalletPersister`

This replaces `bdk_chain::PersistWith` which wanted to persist anything
(not only `Wallet`), hence, requiring a whole bunch of generic
parameters.

Having `WalletPersister` dedicated to persisting `Wallet` simplifies the
trait by a lot.

In addition, `AsyncWalletPersister` has proper lifetime bounds whereas
`bdk_chain::PersistAsyncWith` did not.

16 months agoMerge bitcoindevkit/bdk#1549: fix(example_cli): add bitcoin and rand dependencies
Steve Myers [Wed, 14 Aug 2024 19:01:34 +0000 (14:01 -0500)]
Merge bitcoindevkit/bdk#1549: fix(example_cli): add bitcoin and rand dependencies

3675a9e4921f2002f23a32d2f76d65549899edd4 ci: add job to build example-crates independently (Steve Myers)
1adf63cd3bce77b2a6bc2edebf5f54c2d8a191d7 fix(example_cli): add bitcoin and rand dependencies (Steve Myers)

Pull request description:

  ### Description

  Fix building `example_cli` by adding the bitcoin and rand dependencies so it, and the crates that depend on it, can be built independently and not only from the workspace.

  ### Notes to the reviewers

  I also added the  build-examples CI job to verify we can build examples individually.

  ### Changelog notice

  None.

  ### 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:

  * [ ] This pull request breaks the existing API
  * [x] 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:
  ValuedMammal:
    ACK 3675a9e4921f2002f23a32d2f76d65549899edd4
  storopoli:
    ACK 3675a9e4921f2002f23a32d2f76d65549899edd4

Tree-SHA512: c88fdf6cde72959c88c9f4563834824c573afedb1e5136b0f902d919b42b0de18424fb0d05f275c63a0c05da8062dc53ad5825bdc8dc4b12441890e1b799378b

16 months agoMerge bitcoindevkit/bdk#1537: Use explicit names for wallet builder methods that...
Steve Myers [Wed, 14 Aug 2024 18:29:41 +0000 (13:29 -0500)]
Merge bitcoindevkit/bdk#1537: Use explicit names for wallet builder methods that validate rather than set

2391b765eecdfd36f3b7d69aec646c33516f7afa refactor(wallet)!: rename LoadParams methods (thunderbiscuit)

Pull request description:

  This PR is a follow up to the dev call discussion where we decided it was better to PR these changes separate from #1533. This is a breaking change, but I think it's worth it because those will potentially cause runtime errors for users that expect one thing to happen and realize it's something else.

  Left out of this PR but as surfaced in the call probably worth discussing is whether these methods make sense at all or whether they should be removed entirely. What does it mean to return an error when someone loads a wallet from persistence for which the genesis hash doesn't match the one persisted? Maybe worth a new issue; this PR simply attempts to name them correctly.

  ### Description
  See [Q1 in comment here](https://github.com/bitcoindevkit/bdk/pull/1533#issuecomment-2267641603) for more context into the initial question.

  Two of the methods on the builder that loads a wallet were checkers/validators rather than setters:
  - `network()`
  - `genesis_hash()`

  This is confusing for users because when loading a wallet from persistence those things are persisted and cannot be changed, and yet seemingly the option to do that is there with those methods (so now you're re-thinking what you think you know about the changeset and persistence). Moreover, the fields on the [`LoadParams` type](https://docs.rs/bdk_wallet/1.0.0-beta.1/src/bdk_wallet/wallet/params.rs.html#116-124) are correctly named `check_network` and `check_genesis_hash`. This PR simply brings those two methods in line with what they actually do and set on the struct they modify.

  This modification was not done on the `descriptors()` method, because that one is both a validator and a setter if the descriptors passed contain private keys.

  Note that I chose the names `validate_network` and `validate_genesis_hash` but I'm not married to them. If others prefer `check_network` and `check_genesis_hash`, I'm happy to fix them that way instead!

  ### Changelog notice

  ```md
  Breaking:
    - The `LoadParams` type used in the wallet load builder renamed its  `network()` and `genesis_hash` methods to `check_network()` and `check_genesis_hash`. [#1537]

  [#1537]: https://github.com/bitcoindevkit/bdk/pull/1537
  ```

  ### 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:

  * [x] 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 2391b765eecdfd36f3b7d69aec646c33516f7afa

Tree-SHA512: 6852ad165bab230a003b92ae0408176055f8c9101a0936d2d5a41c2a3577e258b045a7f4b796d9bab29ed261caf80b738c4338d4ff9322fbddc8c273ab0ff914

16 months agorefactor(wallet)!: rename LoadParams methods
thunderbiscuit [Tue, 6 Aug 2024 18:21:16 +0000 (14:21 -0400)]
refactor(wallet)!: rename LoadParams methods

The network and genesis_hash methods on the LoadParams struct have been
renamed to check_network and check_genesis_hash to better reflect their
use.

16 months agoMerge bitcoindevkit/bdk#1478: Allow opting out of getting `LocalChain` updates with...
Steve Myers [Wed, 14 Aug 2024 15:17:36 +0000 (10:17 -0500)]
Merge bitcoindevkit/bdk#1478: Allow opting out of getting `LocalChain` updates with `FullScanRequest`/`SyncRequest` structures

6d77e2e2c3e7c8d49c50bd6b41e7dbc3ddd1d275 refactor(chain)!: Rename `spks_with_labels` to `spks_with_indices` (志宇)
584b10aff153e72777209f540c7bd970b4b4de04 docs(esplora): README example, uncomment async import (志宇)
3eb5dd192669f08fe3d936de2138cc61182fd055 fix(chain): correct `Iterator::size_hint` impl (志宇)
96023c0ff2b47953a2e3d465886421d79d0848f9 docs(chain): improve `SyncRequestBuilder::spks_with_labels` docs (志宇)
0234f706ab39d4f68b6cfcf9d3ff5a49d47ae2d7 docs(esplora): Fix typo (志宇)
38f86fe780d698e81108677edd75b0f88176c12f fix: no premature collect (志宇)
44e2a797e65a501dbd9d803456cb203fe561ee7f feat!: rework `FullScanRequest` and `SyncRequest` (志宇)
16c1c2cf012c3a2d197aa845218df3d1aebad435 docs(esplora): Simplify crate docs (志宇)
c93e6fd3e6289f2c7bc12012eae7231d03cb04cb feat(esplora): always fetch prevouts (志宇)
cad35336269fb2f4279cba39ab077ea5b99b1e59 feat(esplora): make ext traits more flexible (志宇)

Pull request description:

  Closes #1528

  ### Description

  Some users use `bdk_esplora` to update `bdk_chain` structures *without* a `LocalChain`. ~~This PR introduces "low-level" methods to `EsploraExt` and `EsploraAsyncExt` which populates a `TxGraph` update with associated data.~~

  We change `FullScanRequest`/`SyncRequest` to take in the `chain_tip` parameter as an option. Spk-based chain sources (`bdk_electrum` and `bdk_esplora`) will not fetch a chain-update if `chain_tip` is `None`, allowing callers to opt-out of receiving updates for `LocalChain`.

  We change `FullScanRequest`/`SyncRequest` to have better ergonomics when inspecting the progress of syncing (refer to #1528).

  We change `FullScanRequest`/`SyncRequest` to be constructed with a builder pattern. This is a better API since we separate request-construction and request-consumption.

  Additionally, much of the `bdk_esplora` logic has been made more efficient (less calls to Esplora) by utilizing the `/tx/:txid` endpoint (`get_tx_info` method). This method returns the tx and tx_status in one call. The logic for fetching updates for outpoints has been reworked to support parallelism.

  Documentation has also been updated.

  ### Notes to reviewers

  This PR has evolved somewhat. Initially, we were adding more methods on `EsploraExt`/`EsploraAsyncExt` to make syncing/scanning more modular. However, it turns out we can just make the `chain_tip` parameter of the request structures optional. Since we are changing the request structures, we might as well go further and improve the ergonomics of the whole structures (refer to #1528). This is where we are at with this PR.

  Unfortunately, the changes are now breaking. I think this is an okay tradeoff for the API improvements (before we get to stable).

  ### Changelog notice

  * Change request structures in `bdk_chain::spk_client` to be constructed via a builder pattern, make providing a `chain_tip` optional, and have better ergonomics for inspecting progress while syncing.
  * Change `bdk_esplora` to be more efficient by reducing the number of calls via the `/tx/:txid` endpoint. The logic for fetching outpoint updates has been reworked to support parallelism.
  * Change `bdk_esplora` to always add prev-txouts to the `TxGraph` update.

  ### 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
  * [x] I've added docs for the new feature

ACKs for top commit:
  ValuedMammal:
    ACK 6d77e2e2c3e7c8d49c50bd6b41e7dbc3ddd1d275
  notmandatory:
    ACK 6d77e2e2c3e7c8d49c50bd6b41e7dbc3ddd1d275

Tree-SHA512: 806cb159a8801f4e33846d18e6053b65d105e452b0f3f9d639b0c3f2e48fb665e632898bf42977901526834587223b0d7ec7ba1f73bb796b5fd8fe91e6f287f7

16 months agorefactor(chain)!: Rename `spks_with_labels` to `spks_with_indices`
志宇 [Tue, 13 Aug 2024 08:15:43 +0000 (08:15 +0000)]
refactor(chain)!: Rename `spks_with_labels` to `spks_with_indices`

and use consistent generic parameter names across `SyncRequest` and
`SyncRequestBuilder`.

16 months agodocs(esplora): README example, uncomment async import
志宇 [Mon, 12 Aug 2024 04:23:16 +0000 (04:23 +0000)]
docs(esplora): README example, uncomment async import

16 months agofix(chain): correct `Iterator::size_hint` impl
志宇 [Mon, 12 Aug 2024 04:02:19 +0000 (04:02 +0000)]
fix(chain): correct `Iterator::size_hint` impl

16 months agodocs(chain): improve `SyncRequestBuilder::spks_with_labels` docs
志宇 [Mon, 12 Aug 2024 03:46:34 +0000 (03:46 +0000)]
docs(chain): improve `SyncRequestBuilder::spks_with_labels` docs

16 months agodocs(esplora): Fix typo
志宇 [Sat, 3 Aug 2024 13:46:18 +0000 (13:46 +0000)]
docs(esplora): Fix typo

16 months agofix: no premature collect
志宇 [Fri, 2 Aug 2024 09:38:27 +0000 (09:38 +0000)]
fix: no premature collect

16 months agofeat!: rework `FullScanRequest` and `SyncRequest`
志宇 [Thu, 1 Aug 2024 09:17:49 +0000 (09:17 +0000)]
feat!: rework `FullScanRequest` and `SyncRequest`

Change `FullScanRequest` and `SyncRequest` take in a `chain_tip` as an
option. In turn, `FullScanResult` and `SyncResult` are also changed to
return the update `chain_tip` as an option. This allows the caller to
opt-out of getting a `LocalChain` update.

Rework `FullScanRequest` and `SyncRequest` to have better ergonomics
when inspecting the progress of items of a sync request. Richer progress
data is provided to the inspect closure.

Introduce `FullScanRequestBuilder` and `SyncRequestBuilder`. Separating
out request-construction and request-consumption in different structs
simplifies the API and method names.

Simplify `EsploraExt` and `EsploraAsyncExt` back to having two methods
(`full_scan` and `sync`). The caller can still opt out of fetching a
`LocalChain` update with the new `FullScanRequest` and `SyncRequest`.

16 months agodocs(esplora): Simplify crate docs
志宇 [Sun, 21 Jul 2024 13:51:00 +0000 (13:51 +0000)]
docs(esplora): Simplify crate docs

16 months agofeat(esplora): always fetch prevouts
志宇 [Tue, 2 Jul 2024 03:53:54 +0000 (03:53 +0000)]
feat(esplora): always fetch prevouts

Prevouts are needed to calculate fees for transactions. They are
introduced as floating txouts in the update `TxGraph`. A helper method
`insert_prevouts` is added to insert the floating txouts using the
`Vin`s returned from Esplora.

Also replaced `anchor_from_status` with `insert_anchor_from_status` as
we always insert the anchor into the update `TxGraph` after getting it.

Also removed `bitcoin` dependency as `bdk_chain` already depends on
`bitcoin` (and it's re-exported).

16 months agofeat(esplora): make ext traits more flexible
志宇 [Sun, 16 Jun 2024 07:37:11 +0000 (15:37 +0800)]
feat(esplora): make ext traits more flexible

Some users would like to use esplora updates with custom `ChainOracle`s
(not `LocalChain`). We introduce "low-level" extension methods that
populate an update `TxGraph` with associated data.

Additionally, much of the logic has been made more efficient. We make
use of the `/tx/:txid` endpoint (`get_tx_info` method) to do a single
call to get both the tx and tx_status. If the tx already exists, we only
fetch the tx_status. The logic for fetching data based on outpoints has
been reworked to be more efficient and it now supports parallelism
Additionally, the logic for fetching data based on outpoints has been
reworked to be more efficient and it now supports parallelism.

Documentation has also been reworked.

Note that this is NOT a breaking change because the API of `full_scan`
and `sync` are not changed.

16 months agoMerge bitcoindevkit/bdk#1533: [wallet] Enable support for single descriptor wallets
志宇 [Wed, 14 Aug 2024 08:09:09 +0000 (08:09 +0000)]
Merge bitcoindevkit/bdk#1533: [wallet] Enable support for single descriptor wallets

13e7008f00b77802481733eb74daf38f48a2faef doc(wallet): clarify docs for `Wallet::load` (valued mammal)
3951110bb596d56a30ddc4cf09903cee4eebedea fix(wallet)!: Change method `LoadParams::descriptors` (valued mammal)
b8027147056bf78beab5e1c606d7fd93c2a57872 example(wallet): simplify miniscript compiler example (valued mammal)
2ca8b6ff73308c3852f454579206f3a234790ce9 test(wallet): Add tests for single descriptor wallet (valued mammal)
31f1c2d665363137e6a2d9fda3ae4ed2532d680b fix(wallet): Change FromSql type to `Option<_>` (valued mammal)
75155b7dc0bb7dfee9046d323fb87b0f8e0321c1 feat(wallet): Add method `Wallet::create_single` (valued mammal)

Pull request description:

  The change descriptor is made optional, making this an effective reversion of #1390 and enables creating wallets with a single descriptor.

  fixes #1511

  ### Notes to the reviewers

  PR 1390 also removed an error case [`ChangePolicyDescriptor`](https://github.com/bitcoindevkit/bdk/blob/8eef350bd08057acc39b6fc50b1217db5e29b968/crates/wallet/src/wallet/mod.rs#L1529-L1533) and this can possibly be added back. In the case the wallet only has a single descriptor we allow any utxos to fund a tx that aren't specifically marked unspendable regardless of the change spend policy.

  ### Changelog notice

  * Added method `Wallet::create_single` that expects a single `D: IntoWalletDescriptor` as input and enables building a wallet with no internal keychain.

  ### 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] This pull request breaks the existing API
  * [x] I've added tests for the new feature
  * [x] I've added docs for the new feature

ACKs for top commit:
  evanlinjin:
    ACK 13e7008f00b77802481733eb74daf38f48a2faef

Tree-SHA512: 3e6fe5d9165d62332ac1863ec769c4bc5c7cd3c7f3fbdb8f505906bcdc681fa73b3fef2571adb0e52e9a23d4257f66a6145838b90ec68596b5f4c64054a047fa

16 months agodoc(wallet): clarify docs for `Wallet::load`
valued mammal [Wed, 14 Aug 2024 02:14:28 +0000 (22:14 -0400)]
doc(wallet): clarify docs for `Wallet::load`

16 months agofix(wallet)!: Change method `LoadParams::descriptors`
valued mammal [Fri, 9 Aug 2024 13:09:22 +0000 (09:09 -0400)]
fix(wallet)!: Change method `LoadParams::descriptors`

to just `descriptor` that takes a `KeychainKind` and optional
`D: IntoWalletDescriptor` representing the expected value of
the descriptor in the changeset.

Add method `LoadParams::extract_keys` that will use any private
keys in the provided descriptors to add a signer to the wallet.

16 months agoexample(wallet): simplify miniscript compiler example
valued mammal [Tue, 6 Aug 2024 17:25:25 +0000 (13:25 -0400)]
example(wallet): simplify miniscript compiler example

16 months agotest(wallet): Add tests for single descriptor wallet
valued mammal [Tue, 6 Aug 2024 17:24:42 +0000 (13:24 -0400)]
test(wallet): Add tests for single descriptor wallet

16 months agofix(wallet): Change FromSql type to `Option<_>`
valued mammal [Tue, 6 Aug 2024 18:52:14 +0000 (14:52 -0400)]
fix(wallet): Change FromSql type to `Option<_>`

when selecting a wallet row from sqlite. This is consistent with
the structure of the wallet `ChangeSet` where the fields
`descriptor`, `change_descriptor`, and `network` are all optional.

16 months agofeat(wallet): Add method `Wallet::create_single`
valued mammal [Tue, 6 Aug 2024 15:52:31 +0000 (11:52 -0400)]
feat(wallet): Add method `Wallet::create_single`

that allows creating a wallet with a single descriptor.

16 months agoMerge bitcoindevkit/bdk#1491: Enable selecting use-rustls-ring feature on electrum...
Steve Myers [Tue, 13 Aug 2024 20:20:18 +0000 (15:20 -0500)]
Merge bitcoindevkit/bdk#1491: Enable selecting use-rustls-ring feature on electrum client

f965f95721c719ac755da07aa997d9b858583856 feat: enable selecting use-rustls-ring feature on electrum client (thunderbiscuit)

Pull request description:

  This PR is a companion to bitcoindevkit/rust-electrum-client#135. It enables choosing the `ring` dependency on rustls instead of the new default (as of 0.23.0) `aws-lc-rs`. The AWS dependency breaks the Android and Swift builds. I wrote a more detailed explanation on [#135](https://github.com/bitcoindevkit/rust-electrum-client/pull/135).

  ### Notes to the reviewers

  Do not merge before:
  - [x] [#135](https://github.com/bitcoindevkit/rust-electrum-client/pull/135) is merged
  - [x] A new version of rust-electrum-client is released (will be 0.21.0)
  - [x] The dependency points to the new version of the client rather than my fork of it.

  ### Changelog notice

  ```md
  Added
      - bdk_electrum now enables choosing either the `use-rustls` or `use-rustls-ring` feature
  ```

  ### 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:
  LLFourn:
    ACK f965f95721c719ac755da07aa997d9b858583856
  notmandatory:
    utACK f965f95721c719ac755da07aa997d9b858583856
  oleonardolima:
    ACK f965f95721c719ac755da07aa997d9b858583856

Tree-SHA512: c82afa82ef8603bc8e6d024ee5030fa1ec6ab71fbce090182ce3a297ce1a788c1db48f593f05331b1de1931a731a5fc03f804cb1b17f8c7832286fda6c09aa4b

16 months agoMerge bitcoindevkit/bdk#1494: Add documentation for Electrum's full_scan/sync
志宇 [Tue, 13 Aug 2024 08:53:58 +0000 (08:53 +0000)]
Merge bitcoindevkit/bdk#1494: Add documentation for Electrum's full_scan/sync

7b5657e23e17c6934773dfdff0ed214ff3b8f110 docs(electrum): enhance API docs for fetch_prev_txouts argument (thunderbiscuit)

Pull request description:

  This PR also serves as an issue; it can't really be merged as is. I just didn't want to open an issue and just ask for better docs and instead decided to open a PR with some unfinished new API docs.

  I am working on a page for the Book of BDK that focuses on bdk_wallet + bdk_electrum syncing. A few things have been unclear to me, and I think slight additions to the API docs would fix that for others.

  ~~1. I was wondering what exactly this `confirmation_time` field on the `bdk_chain::ConfirmationTimeHeightAnchor` type represents. After digging into it (at least for the electrum client), it represents the timestamp specified by the block header where the tx was confirmed. _Question: I'd like to confirm that this always the case, e.g. that this is the timestamp used in cases where your client is an Esplora or bitcoind RPC node?_ If so, my addition to the sentence will make sense and is ready to go.~~ Edit: this is no longer a type after the rebase.
  2. I think it'd be great to add context to the `fetch_prev_txouts` argument on the full_scan and sync methods on the `BdkElectrumClient`. It says that this is necessary for "fee calculation". What does that mean? I assume it means "for calculating the fee rate on the given transactions"? (let me know if that's wrong). Even so, I'm left wondering what happens if I don't fetch them. Will my fee calculations be just plain wrong? Or will they be unavailable? A bit more context for the caller of the method would be great here. If someone knows the definite answer to this let me know and feel free to propose a doc line and I'll amend the commit!

  ### Checklists
  * [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:
    re-ACK 7b5657e23e17c6934773dfdff0ed214ff3b8f110

Tree-SHA512: f0ac9ae4a116c9a3f5006d6a41f626ac36c3f8495204a9eaa06d2c8003cabe0005be33fcc810028d314c505c3385a5facd2bedb3b2218ddf272b0fa2220abd39

16 months agoci: add job to build example-crates independently
Steve Myers [Mon, 12 Aug 2024 22:30:11 +0000 (17:30 -0500)]
ci: add job to build example-crates independently

16 months agofix(example_cli): add bitcoin and rand dependencies
Steve Myers [Mon, 12 Aug 2024 22:26:33 +0000 (17:26 -0500)]
fix(example_cli): add bitcoin and rand dependencies

The bitcoin and rand dependencies are required to build examples
independently and not from the top level bdk workspace.

16 months agofeat: enable selecting use-rustls-ring feature on electrum client
thunderbiscuit [Wed, 26 Jun 2024 14:52:57 +0000 (10:52 -0400)]
feat: enable selecting use-rustls-ring feature on electrum client

16 months agodocs(electrum): enhance API docs for fetch_prev_txouts argument
thunderbiscuit [Fri, 28 Jun 2024 15:59:10 +0000 (11:59 -0400)]
docs(electrum): enhance API docs for fetch_prev_txouts argument

16 months agoMerge bitcoindevkit/bdk#1535: test(electrum): Test sync in reorg and no-reorg situations
志宇 [Mon, 12 Aug 2024 09:51:51 +0000 (09:51 +0000)]
Merge bitcoindevkit/bdk#1535: test(electrum): Test sync in reorg and no-reorg situations

2c0bc45ecf0241abc8bf9d72c8bbeded53d32a45 feat(testenv): Added `bdk_electrum` wait for Txid method (Wei Chen)
49e1a5e871de31e87cc9a4d329cd2b1477f32fd0 test(electrum): Test sync in reorg and no-reorg situations (Wei Chen)

Pull request description:

  <!-- You can erase any parts of this template not applicable to your Pull Request. -->
  Closes #1125.

  ### Description

  <!-- Describe the purpose of this PR, what's being adding and/or fixed -->
  Add new test for `bdk_electrum` to make sure previously unconfirmed transactions get confirmed again in both reorg and no-reorg situations.

  ### Changelog notice

  <!-- Notice the release manager should include in the release tag message changelog -->
  <!-- See https://keepachangelog.com/en/1.0.0/ for examples -->
  * Added `wait_until_electrum_sees_txid` method to `TestEnv`.
  * `wait_until_electrum_sees_block` now has a `Duration` input for timeout.
  * Removed exponential polling delay in `wait_until_electrum_sees_block`.
  * Added `test_sync` to `bdk_electrum` to make sure previously unconfirmed transactions get confirmed in both reorg and no-org situations.

  ### 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 2c0bc45ecf0241abc8bf9d72c8bbeded53d32a45

Tree-SHA512: 2218151267fe0a3dc3eefa1e7081902e25193f211b2624a3a9f2007b9b38eefb5b847754b9f8cbefba6be6a497cfbc85ac3e5a2db40f01fcc71a3c9d8427adf4

16 months agoMerge bitcoindevkit/bdk#1545: feat(testenv): Add method `new_with_config`
志宇 [Mon, 12 Aug 2024 09:35:06 +0000 (09:35 +0000)]
Merge bitcoindevkit/bdk#1545: feat(testenv): Add method `new_with_config`

b3b65514b7243664d24e4a9623d93ef619650d28 feat(testenv): Add method `new_with_config` (valued mammal)

Pull request description:

  I think this will be useful for passing a custom bitcoin config including e.g. `-blockfilterindex` that would not otherwise be included in the default config.

  ### Notes to the reviewers

  Any other suggestions let me know @LagginTimes

  ### Changelog notice

  * Added method `TestEnv::new_with_config` for passing custom `bitcoind::Conf`, `electrsd::Conf` config objects

  ### 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 b3b65514b7243664d24e4a9623d93ef619650d28
  evanlinjin:
    ACK b3b65514b7243664d24e4a9623d93ef619650d28

Tree-SHA512: f771505bc4e7096e89c697a18cfaa367e2ffa57616ca9f2d02d0ad7672c148bb0eb17f66b5e7ab2bbf16fcca4b7457c0c43d892119b0feb6c1462d4034a81a9b

16 months agofeat(testenv): Added `bdk_electrum` wait for Txid method
Wei Chen [Thu, 8 Aug 2024 14:17:01 +0000 (22:17 +0800)]
feat(testenv): Added `bdk_electrum` wait for Txid method

Added `wait_until_electrum_sees_txid` method to `TestEnv`. Both
`bdk_electrum` wait methods now have a `timeout` option. Removed
the exponential polling delay in lieu of a fixed delay inside the
`bdk_electrum` wait methods.

16 months agotest(electrum): Test sync in reorg and no-reorg situations
Wei Chen [Thu, 8 Aug 2024 14:18:28 +0000 (22:18 +0800)]
test(electrum): Test sync in reorg and no-reorg situations

Add test for `bdk_electrum` to make sure previously unconfirmed
transactions get confirmed again in both reorg and no-reorg
situations.

16 months agoMerge bitcoindevkit/bdk#1495: example: Update `example_cli` and retire old nursery...
志宇 [Mon, 12 Aug 2024 04:35:25 +0000 (04:35 +0000)]
Merge bitcoindevkit/bdk#1495: example: Update `example_cli` and retire old nursery crates

771f6b9c97a70be2e8d2da5216f3b686295861bd example: Update example_cli (valued mammal)

Pull request description:

  - Adds two commands `init` and `generate`. Loading database doesn't require descriptors
  - Replaces `send` command with `psbt` (new, sign, and extract). Supports tap key spend
  - Uses `bdk-coin-select` and miniscript `plan` module

  fixes #1469
  partially addresses #1462

  ### Notes to the reviewers

  Note the `example_cli` lib now defines the `ChangeSet` and `Anchor` type whereas before these were generic

  ### Changelog notice

  * Improvements to `example_cli` that include generating descriptors and creating PSBTs

  ### 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 771f6b9c97a70be2e8d2da5216f3b686295861bd

Tree-SHA512: 93b9e38ec428c3ed5920e7632381dcf50e28a01ceb8e1438c87aa459563600cd79636bcf1179eefa763adce98239a60ad2894dfb2ba0f2700cc64e57ede75010

16 months agofeat(testenv): Add method `new_with_config`
valued mammal [Fri, 9 Aug 2024 02:43:29 +0000 (22:43 -0400)]
feat(testenv): Add method `new_with_config`

This allows passing a custom config for either `BitcoinD` or
`ElectrsD`. We also add a new `pub struct Config` for holding
each of `bitcoind::Conf` and `electrsd::Conf`.

16 months agoMerge bitcoindevkit/bdk#1544: Remove crate-renaming
志宇 [Fri, 9 Aug 2024 16:18:17 +0000 (16:18 +0000)]
Merge bitcoindevkit/bdk#1544: Remove crate-renaming

318ce095f2adec9d03077ddf65470ff475547f39 refactor(chain): remove crate-renaming (志宇)

Pull request description:

  ### Description

  [Rust 1.60 introduces *"namespaced features"*](https://blog.rust-lang.org/2022/04/07/Rust-1.60.0.html#new-syntax-for-cargo-features) so we can add a dependency without implicitly also defining a feature of the same name.

  We can now get rid of crate-renaming and use "namespaced features" instead.

  Thanks to @LLFourn for pointing this out.

  ### Changelog notice

  * Remove crate-renaming in `bdk_chain` and use "namespaced features" instead.

  ### 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:
  LLFourn:
    ACK 318ce095f2adec9d03077ddf65470ff475547f39

Tree-SHA512: 5e8f9002eda50dd73c6b38988d288f96d5c827d8e8ec6bdf6ad8da497cecd0f41e709158a96c9e9736a41b825a86ad2ed706b60eca0786976e551f6e25eb0c74