]> Untitled Git - bdk/log
bdk
22 months agoMerge bitcoindevkit/bdk#1289: doc(electrum_ext): fix docs for `RelevantTxids::into_co...
Daniela Brozzoni [Mon, 22 Jan 2024 11:19:25 +0000 (12:19 +0100)]
Merge bitcoindevkit/bdk#1289: doc(electrum_ext): fix docs for `RelevantTxids::into_confirmation_tim…

cf0c3337446b1de19ad6be9e68f5a9cb848d5773 doc(electrum_ext): fix docs for `RelevantTxids::into_confirmation_time_tx_graph` (vmammal)

Pull request description:

  Note also, the bit referring to Electrum's API sounds more like a developer note, so I made it a regular code comment.

  ### 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:
  danielabrozzoni:
    ACK cf0c3337446b1de19ad6be9e68f5a9cb848d5773

Tree-SHA512: 0ebd6a753c8a0c573510a4d866068cb6e1c7e356c43b20b5179331a1b7d567e4dfbf7012c63ba9b7b9566bf6564a2d957d12e54d5c0232b7be9869dfe0958e85

22 months agofix(readme): update examples
Jose Storopoli [Mon, 15 Jan 2024 22:58:42 +0000 (19:58 -0300)]
fix(readme): update examples

22 months agoMerge bitcoindevkit/bdk#1291: doc(chain,esplora): minor documentation improvements
Daniela Brozzoni [Mon, 22 Jan 2024 11:01:27 +0000 (12:01 +0100)]
Merge bitcoindevkit/bdk#1291: doc(chain,esplora): minor documentation improvements

b6a58d4f9bab13be0f3518f556936fa77a6b7b39 doc(chain,esplora): minor documentation improvements (vmammal)

Pull request description:

  * Corrects an awkward use of the word 'an'
  * Adds missing backticks, brackets in a few places

  ### 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:
  danielabrozzoni:
    ACK b6a58d4f9bab13be0f3518f556936fa77a6b7b39

Tree-SHA512: 42f12f218a9849b6fc1c8da28c4d41ca86fcc9ea52311d28f67fadbec030b6cb6986774d89a30e7a2b5ee569b08c7cfa2af71bbb9b06efacfa685dbe95820f73

22 months agoMerge bitcoindevkit/bdk#1288: doc(esplora): fix broken link in README
Daniela Brozzoni [Mon, 22 Jan 2024 10:53:25 +0000 (11:53 +0100)]
Merge bitcoindevkit/bdk#1288: doc(esplora): fix broken link in README

7c0f4653b281b4288e92ed8cd45ead8abd104f52 doc(esplora): fix broken link in README (vmammal)

Pull request description:

  ### 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:
  danielabrozzoni:
    ACK 7c0f4653b281b4288e92ed8cd45ead8abd104f52

Tree-SHA512: 6e09a0b74c1a64bc9d0d0a067daf7766c4a46511c22b676251f61608d770d3ea2c1df81d4e9bbbee69720cad5cd2deb9b146cb7751277871f0cbf1be96efcc9f

23 months agoMerge bitcoindevkit/bdk#1285: doc(wallet): improve docs for `Wallet::sent_and_received`
志宇 [Fri, 19 Jan 2024 15:37:59 +0000 (23:37 +0800)]
Merge bitcoindevkit/bdk#1285: doc(wallet): improve docs for `Wallet::sent_and_received`

08b745ec9f16fa8ef18b0d9c92feb9d8ab87a184 doc(wallet): improve docs for `Wallet::sent_and_received` (vmammal)

Pull request description:

  Thank you @thunderbiscuit for raising this issue. I noticed this method borrows the language from `SpkTxOutIndex::sent_and_received`, which this PR doesn't touch. I think in general it's desirable that methods in `bdk_chain` crate would refer to some of the core structures directly.

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

Tree-SHA512: 7f1285c4baa5fb56fd65baa5585bd343338de9988b941618a2b9ab628d869563f6f71ce842f936e7e1fb6a56f2f1e50fc3deaff858e830b7039888e4e496ce9a

23 months agoMerge bitcoindevkit/bdk#1292: fix(store): Remove lifetime
志宇 [Fri, 19 Jan 2024 15:28:19 +0000 (23:28 +0800)]
Merge bitcoindevkit/bdk#1292: fix(store): Remove lifetime

e6433fb2c1526cff37e3a17cc71986759ebac30f feat(persist): Add stage_and_commit to Persist (LLFourn)
0bee46e75bc99112abc15de59984e6059ff874e5 fix(store): Remove lifetime (LLFourn)

Pull request description:

  Remove gratuitous use of lifetimes in the main persistence struct `Store`. Having lifetimes on this means that you have to keep the magic bytes alive longer than the database which is particularly offensive if you have to send the database to another thread. On top of that the bytes aren't even read.

ACKs for top commit:
  evanlinjin:
    ACK e6433fb2c1526cff37e3a17cc71986759ebac30f

Tree-SHA512: 7f6d9d60951a8ceaee30719d0771e15632c6fad0702294af15409c5df492669a07299874ef5ee34e3d75bdecbbd41df29bced3ff16b2360d5d5c7687ef677ffc

23 months agotest(esplora): introduce test cases for `update_local_chain`
志宇 [Thu, 11 Jan 2024 17:25:17 +0000 (01:25 +0800)]
test(esplora): introduce test cases for `update_local_chain`

23 months agofeat(esplora): greatly simplify `update_local_chain`
志宇 [Thu, 11 Jan 2024 13:23:52 +0000 (21:23 +0800)]
feat(esplora): greatly simplify `update_local_chain`

23 months agoMerge bitcoindevkit/bdk#1172: Introduce block-by-block API to `bdk::Wallet` and add...
志宇 [Fri, 19 Jan 2024 15:07:20 +0000 (23:07 +0800)]
Merge bitcoindevkit/bdk#1172: Introduce block-by-block API to `bdk::Wallet` and add RPC wallet example

a4f28c079e3bc4500e8329aeed230d8100d38617 chore: improve LocalChain::apply_header_connected_to doc (LLFourn)
8ec65f0b8ef7d452a0bdba6760c46bd8511c91ff feat(example): add RPC wallet example (Vladimir Fomene)
a7d01dc39acb3ff7f4bc8e237c7862d019a91cd1 feat(chain)!: make `IndexedTxGraph::apply_block_relevant` more efficient (志宇)
e0512acf9476fa3fa7da9cc28a222432f974aad5 feat(bitcoind_rpc)!: emissions include checkpoint and connected_to data (志宇)
8f2d4d9d400e398b54cf1bad36057f3f8f4a69a4 test(chain): `LocalChain` test for update that is shorter than original (志宇)
9467cad55d68354fe037d57bceeee57c2032bd51 feat(wallet): introduce block-by-block api (Vladimir Fomene)
d3e5095df10d21ff5cb7f8ce4dab7922f3cb6e35 feat(chain): add `apply_header..` methods to `LocalChain` (志宇)
2b61a122ff40253f2e67c0ae6824ce881c9f12a1 feat(chain): add `CheckPoint::from_block_ids` convenience method (志宇)

Pull request description:

  ### Description

  Introduce block-by-block API for `bdk::Wallet`. A `wallet_rpc` example is added to demonstrate syncing `bdk::Wallet` with the `bdk_bitcoind_rpc` chain-source crate.

  The API of `bdk_bitcoind_rpc::Emitter` is changed so the receiver knows how to connect to the block emitted.

  ### Notes to the reviewers

  ### Changelog notice

  Added
  * `Wallet` methods to apply full blocks (`apply_block` and `apply_block_connected_to`) and a method to apply a batch of unconfirmed transactions (`apply_unconfirmed_txs`).
  * `CheckPoint::from_block_ids` convenience method.
  * `LocalChain` methods to apply a block header (`apply_header` and `apply_header_connected_to`).
  * Test to show that `LocalChain` can apply updates that are shorter than original. This will happen during reorgs if we sync wallet with `bdk_bitcoind_rpc::Emitter`.

  Fixed
  * `InsertTxError` now implements `std::error::Error`.

  #### 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:
  LLFourn:
    self-ACK: a4f28c079e3bc4500e8329aeed230d8100d38617
  evanlinjin:
    ACK a4f28c079e3bc4500e8329aeed230d8100d38617

Tree-SHA512: e39fb65b4e69c0a6748d64eab12913dc9cfe5eb8355ab8fb68f60a37c3bb2e1489ddd8f2f138c6470135344f40e3dc671928f65d303fd41fb63f577b30895b60

23 months agofeat(persist): Add stage_and_commit to Persist
LLFourn [Fri, 19 Jan 2024 00:23:46 +0000 (11:23 +1100)]
feat(persist): Add stage_and_commit to Persist

In the example_cli we were not always committing (seemingly by mistake).
This then caused all the examples to have to compensate by manually
committing.

23 months agofix(store): Remove lifetime
LLFourn [Thu, 18 Jan 2024 23:34:37 +0000 (10:34 +1100)]
fix(store): Remove lifetime

Remove gratuitous use of lifetimes in the main persistence struct

23 months agodoc(wallet): improve docs for `Wallet::sent_and_received`
vmammal [Wed, 17 Jan 2024 18:00:27 +0000 (13:00 -0500)]
doc(wallet): improve docs for `Wallet::sent_and_received`

23 months agoMerge bitcoindevkit/bdk#1282: Bump version to 1.0.0-alpha.4 v1.0.0-alpha.4
志宇 [Thu, 18 Jan 2024 11:22:41 +0000 (19:22 +0800)]
Merge bitcoindevkit/bdk#1282: Bump version to 1.0.0-alpha.4

d33acc14661326972b3ab3cf2b7cee4ca078f4da Bump version to 1.0.0-alpha.4 (Steve Myers)

Pull request description:

  ### Description

  Bump version to 1.0.0-alpha.4, also:

  bdk_chain to 0.8.0
  bdk_bitcoind_rpc to 0.3.0
  bdk_electrum to 0.6.0
  bdk_esplora to 0.6.0
  bdk_file_store to 0.4.0

  Fixes #1281.

  ### Notes to the reviewers

  Since the version of bdk_chain changed all crates that depend on it also need to have their versions bumped.

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

Tree-SHA512: ffb5c05b45e9d646ef796bd894353e4b58c3aae3dcf0921dfb9fcae45020ed4fc82274a7497494d6259bfffff9c2f97c530d2cbe6ace578babd04852af461f3a

23 months agoBump version to 1.0.0-alpha.4
Steve Myers [Tue, 16 Jan 2024 17:28:41 +0000 (11:28 -0600)]
Bump version to 1.0.0-alpha.4

bdk_chain to 0.8.0
bdk_bitcoind_rpc to 0.3.0
bdk_electrum to 0.6.0
bdk_esplora to 0.6.0
bdk_file_store to 0.4.0

23 months agoMerge bitcoindevkit/bdk#1286: doc, example(bdk): fix derivation path in mnemonic_to_d...
Daniela Brozzoni [Thu, 18 Jan 2024 11:05:25 +0000 (12:05 +0100)]
Merge bitcoindevkit/bdk#1286: doc, example(bdk): fix derivation path in mnemonic_to_descriptors

d494f63d08f60ce01c22ff08f7e88a80a7be2522 doc, example(bdk): fix derivation path in mnemonic_to_descriptors (vmammal)

Pull request description:

  This will help avoid confusion with mainnet 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:
  danielabrozzoni:
    ACK d494f63d08f60ce01c22ff08f7e88a80a7be2522

Tree-SHA512: f0450d171bc53085204280495f2954e20f4b64a73cfbcc9a0c3be131c0b04ad53e936c83fa83c89fbd1ed1c4edd680e8437550453f75056049d36f84cae1df43

23 months agoMerge bitcoindevkit/bdk#1269: Revamp `KeychainTxOutIndex` API to be safer
Daniela Brozzoni [Thu, 18 Jan 2024 10:24:31 +0000 (11:24 +0100)]
Merge bitcoindevkit/bdk#1269: Revamp `KeychainTxOutIndex` API to be safer

71fff1613d1c167d180636857063e181f6acedf1 feat(chain): add txout methods to `KeychainTxOutIndex` (志宇)
83e7b7ec402bef27c3f83876f346ec2abd23eff1 docs(chain): improve `KeychainTxOutIndex` docs (志宇)
9294e30943f3f79bb36915d69652d9086323131f docs(wallet): improve docs for unbounded spk iterator methods (志宇)
b74c2e262255a39e9dc904aad469e307bf7d0151 fix(wallet): use efficient peek address logic (志宇)
81aeaba48a980a7e7add76ac2d24e896bedaa1d2 feat(chain): add `SpkIterator::descriptor` method (志宇)
c7b47af72f278ba73abea58db49cff1245428f97 refactor(chain)!: revamp `KeychainTxOutIndex` API (志宇)
705690ee8fddba8517d907183b7ddfeafb633609 feat(chain): make output of `SpkTxOutIndex::unused_spks` cloneable (志宇)

Pull request description:

  Closes #1268

  ### Description

  Previously `SpkTxOutIndex` methods can be called from `KeychainTxOutIndex` due to the `DeRef` implementation. However, the internal `SpkTxOut` will also contain lookahead spks resulting in an error-prone API.

  `SpkTxOutIndex` methods are now not directly callable from `KeychainTxOutIndex`. Methods of `KeychainTxOutIndex` are renamed for clarity. I.e. methods that return an unbounded spk iter are prefixed with `unbounded`.

  In addition to this, I also optimized the peek-address logic of `bdk::Wallet` using the optimized `<SpkIterator as Iterator>::nth` implementation.

  ### Notes to the reviewers

  This is mostly refactoring, but can also be considered a bug-fix (as the API before was very problematic).

  ### Changelog notice

  Changed
  * Wallet's peek-address logic is optimized by making use of `<SpkIterator as Iterator>::nth`.
  * `KeychainTxOutIndex` API is refactored to better differentiate between methods that return unbounded vs stored spks.
  * `KeychainTxOutIndex` no longer directly exposes `SpkTxOutIndex` methods via `DeRef`. This was problematic because `SpkTxOutIndex` also contains lookahead spks which we want to hide.

  Added
  * `SpkIterator::descriptor` method which gets a reference to the internal descriptor.

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

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

ACKs for top commit:
  danielabrozzoni:
    ACK 71fff1613d1c167d180636857063e181f6acedf1

Tree-SHA512: f29c7d2311d0e81c4fe29b8f57c219c24db958194fad5de82bb6d42d562d37fd5d152be7ee03a3f00843be5760569ad29b848250267a548d7d15320fd5292a8f

23 months agofeat(chain): add txout methods to `KeychainTxOutIndex`
志宇 [Thu, 18 Jan 2024 06:30:29 +0000 (14:30 +0800)]
feat(chain): add txout methods to `KeychainTxOutIndex`

`txouts` and `txouts_in_tx` are exposed from `SpkTxOutIndex`, but
modified to remove nested unions.

Add `keychain_outpoints_in_range` that iterates over outpoints of a
given keychain derivation range.

23 months agodoc(chain,esplora): minor documentation improvements
vmammal [Wed, 17 Jan 2024 19:07:14 +0000 (14:07 -0500)]
doc(chain,esplora): minor documentation improvements

* Corrects an awkward use of the word 'an'
* Adds missing backticks, brackets in a few places

23 months agodoc(electrum_ext): fix docs for `RelevantTxids::into_confirmation_time_tx_graph`
vmammal [Wed, 17 Jan 2024 18:49:58 +0000 (13:49 -0500)]
doc(electrum_ext): fix docs for `RelevantTxids::into_confirmation_time_tx_graph`

23 months agodoc(esplora): fix broken link in README
vmammal [Wed, 17 Jan 2024 18:45:35 +0000 (13:45 -0500)]
doc(esplora): fix broken link in README

23 months agodoc(store): update doc for `Store::aggregate_changesets`
vmammal [Wed, 17 Jan 2024 18:41:23 +0000 (13:41 -0500)]
doc(store): update doc for `Store::aggregate_changesets`

23 months agodoc, example(bdk): fix derivation path in mnemonic_to_descriptors
vmammal [Wed, 17 Jan 2024 18:29:25 +0000 (13:29 -0500)]
doc, example(bdk): fix derivation path in mnemonic_to_descriptors

This will help avoid confusion with mainnet descriptors.

23 months agodocs(chain): improve `KeychainTxOutIndex` docs
志宇 [Wed, 17 Jan 2024 05:30:28 +0000 (13:30 +0800)]
docs(chain): improve `KeychainTxOutIndex` docs

More clarity for revealed/lookahead spks and give usecases.

23 months agodocs(wallet): improve docs for unbounded spk iterator methods
志宇 [Wed, 17 Jan 2024 05:29:16 +0000 (13:29 +0800)]
docs(wallet): improve docs for unbounded spk iterator methods

23 months agofix(wallet): use efficient peek address logic
志宇 [Sat, 13 Jan 2024 12:38:11 +0000 (20:38 +0800)]
fix(wallet): use efficient peek address logic

Changes the peek address logic to use the optimized `Iterator::nth`
implementation of `SpkIterator`.

Additionally, docs are added for panics that will occur when the caller
requests for addresses with out-of-bound derivation indices (BIP32).

23 months agofeat(chain): add `SpkIterator::descriptor` method
志宇 [Sat, 13 Jan 2024 10:33:01 +0000 (18:33 +0800)]
feat(chain): add `SpkIterator::descriptor` method

Otherwise there will be no way to view the descriptor of the
`SpkIterator`.

23 months agorefactor(chain)!: revamp `KeychainTxOutIndex` API
志宇 [Sat, 13 Jan 2024 12:04:49 +0000 (20:04 +0800)]
refactor(chain)!: revamp `KeychainTxOutIndex` API

Previously `SpkTxOutIndex` methods can be called from
`KeychainTxOutIndex` due to the `DeRef` implementation. However, the
internal `SpkTxOut` will also contain lookahead spks resulting in an
error-prone API.

`SpkTxOutIndex` methods are now not directly callable from
`KeychainTxOutIndex`. Methods of `KeychainTxOutIndex` are renamed for
clarity. I.e. methods that return an unbounded spk iter are prefixed
with `unbounded`.

23 months agotest(wallet): fix tests helpers to generate unique utxos
志宇 [Tue, 16 Jan 2024 14:33:42 +0000 (22:33 +0800)]
test(wallet): fix tests helpers to generate unique utxos

23 months agochore: improve LocalChain::apply_header_connected_to doc
LLFourn [Mon, 15 Jan 2024 23:29:49 +0000 (10:29 +1100)]
chore: improve LocalChain::apply_header_connected_to doc

23 months agofeat(example): add RPC wallet example
Vladimir Fomene [Wed, 11 Oct 2023 08:16:38 +0000 (11:16 +0300)]
feat(example): add RPC wallet example

Co-authored-by: Vladimir Fomene <vladimirfomene@gmail.com>
Co-authored-by: 志宇 <hello@evanlinjin.me>
23 months agofeat(chain)!: make `IndexedTxGraph::apply_block_relevant` more efficient
志宇 [Tue, 2 Jan 2024 09:31:34 +0000 (17:31 +0800)]
feat(chain)!: make `IndexedTxGraph::apply_block_relevant` more efficient

Previously, `apply_block_relevant` used `batch_insert_relevant` which
allows inserting non-topologically-ordered transactions. However,
transactions from blocks are always ordered, so we can avoid looping
through block transactions twice (as done in `batch_insert_relevant`).

Additionally, `apply_block_relevant` now takes in a reference to a
`Block` instead of consuming the `Block`. This makes sense as typically
very few of the transactions in the block are inserted.

23 months agofeat(bitcoind_rpc)!: emissions include checkpoint and connected_to data
志宇 [Sat, 30 Dec 2023 12:48:20 +0000 (20:48 +0800)]
feat(bitcoind_rpc)!: emissions include checkpoint and connected_to data

Previously, emissions are purely blocks + the block height. This means
emitted blocks can only connect to previous-adjacent blocks. Hence, sync
must start from genesis and include every block.

23 months agotest(chain): `LocalChain` test for update that is shorter than original
志宇 [Fri, 29 Dec 2023 10:23:42 +0000 (18:23 +0800)]
test(chain): `LocalChain` test for update that is shorter than original

23 months agofeat(wallet): introduce block-by-block api
Vladimir Fomene [Wed, 11 Oct 2023 10:42:21 +0000 (13:42 +0300)]
feat(wallet): introduce block-by-block api

* methods `process_block` and `process_unconfirmed_txs` are added
* amend stage method docs

Co-authored-by: Vladimir Fomene <vladimirfomene@gmail.com>
Co-authored-by: 志宇 <hello@evanlinjin.me>
23 months agofeat(chain): add `apply_header..` methods to `LocalChain`
志宇 [Wed, 10 Jan 2024 16:05:04 +0000 (00:05 +0800)]
feat(chain): add `apply_header..` methods to `LocalChain`

These are convenience methods to transform a header into checkpoints to
update the `LocalChain` with. Tests are included.

23 months agofeat(chain): add `CheckPoint::from_block_ids` convenience method
志宇 [Wed, 10 Jan 2024 09:42:03 +0000 (17:42 +0800)]
feat(chain): add `CheckPoint::from_block_ids` convenience method

23 months agoMerge bitcoindevkit/bdk#1276: Add `LocalChain::disconnect_from` method
Daniela Brozzoni [Mon, 15 Jan 2024 12:56:48 +0000 (13:56 +0100)]
Merge bitcoindevkit/bdk#1276: Add `LocalChain::disconnect_from` method

bf67519768d91b049bf3a47c234ff71a81d0ede9 feat(chain): add `LocalChain::disconnect_from` method (志宇)

Pull request description:

  Closes #1271

  ### Description

  Add a method for disconnecting a chain of blocks starting from the given `BlockId`.

  ### Notes to the reviewers

  I want to have this for https://github.com/utreexo/utreexod/pull/110

  ### Changelog notice

  Added
  * `LocalChain::disconnect_from` method to evict a chain of blocks starting from a given `BlockId`.

  ### 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:
  danielabrozzoni:
    ACK bf67519768d91b049bf3a47c234ff71a81d0ede9

Tree-SHA512: e6bd213b49b553355370994567722ad2c3460d11fcd81adc65a85e5d03822d3c38e4a4d7f967044991cf0187845467b67d035bf8904871f9fcc4ea61be761ef7

23 months agofeat(chain): add `LocalChain::disconnect_from` method
志宇 [Mon, 15 Jan 2024 09:48:36 +0000 (17:48 +0800)]
feat(chain): add `LocalChain::disconnect_from` method

23 months agoMerge pull request #1274 from evanlinjin/avoid_btreemap_append
Lloyd Fournier [Mon, 15 Jan 2024 05:54:03 +0000 (16:54 +1100)]
Merge pull request #1274 from evanlinjin/avoid_btreemap_append

Avoid using `BTreeMap::append`

23 months agofix(chain): avoid using `BTreeMap::append`
志宇 [Sun, 7 Jan 2024 06:39:31 +0000 (14:39 +0800)]
fix(chain): avoid using `BTreeMap::append`

The implementation of `BTreeMap::append` is non-performant making
merging changesets very slow. We use `Extend::extend` instead.

Refer to:
https://github.com/rust-lang/rust/issues/34666#issuecomment-675658420

23 months agofeat(chain): make output of `SpkTxOutIndex::unused_spks` cloneable
志宇 [Sat, 13 Jan 2024 11:57:30 +0000 (19:57 +0800)]
feat(chain): make output of `SpkTxOutIndex::unused_spks` cloneable

This allows us to pass this to chain sources without calling
`Iterator::collect` first.

23 months agotest(file_store): `last_write_is_short`
志宇 [Sat, 13 Jan 2024 09:47:13 +0000 (17:47 +0800)]
test(file_store): `last_write_is_short`

This test simulates a situation where the last write to the db is short.

Aggregating the changeset after reopening the file should return an
error (which includes a partially-aggregated changeset) containing an
aggregation of changesets that were fully written.

At this point, the test re-writes the final changeset (and this time it
successfully writes in full).

The file should be recoverable with all changesets, including the last
one.

23 months agofeat(file_store)!: optimize `EntryIter` by reducing syscalls
志宇 [Sun, 7 Jan 2024 08:09:03 +0000 (16:09 +0800)]
feat(file_store)!: optimize `EntryIter` by reducing syscalls

* Wrap file reader with `BufReader`. This reduces calls to `read`.
* Wrap file reader with `CountingReader`. This counts the bytes read by
  the underlying reader. We can rewind without seeking first.

23 months agoMerge bitcoindevkit/bdk#1264: fix(example_electrum): init LocalChain from genesis
志宇 [Thu, 11 Jan 2024 09:00:30 +0000 (17:00 +0800)]
Merge bitcoindevkit/bdk#1264: fix(example_electrum): init LocalChain from genesis

5b7794299308cd81a2ebbe0aa2b1be1d4c47680b fix(example_electrum): init LocalChain from genesis (vmammal)

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

  This should fix #1252

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

Tree-SHA512: bf049edb2ba22abb949dfd4cb38608589287f3f374f397c82f778b59c21010daa80b63ad85c442c4ee00a2608f89a8d50447b0db85d15caac7fd0b4fd8956e1a

23 months agoMerge bitcoindevkit/bdk#1261: Refactor `reveal_to_target` and `next_store_index`
志宇 [Thu, 11 Jan 2024 02:59:45 +0000 (10:59 +0800)]
Merge bitcoindevkit/bdk#1261: Refactor `reveal_to_target` and `next_store_index`

761189ab2b679fbfee45b33435d66ed98a135e2a feat(chain): debug_assert non-wildcard desc. to only cache index 0 (志宇)
887e112e8f4ee5300bf09a0f3590861bff7fd053 ref(chain): Refactor reveal_to_target (Daniela Brozzoni)
21d88758262bfbc3d9d2109aac9883f23ab651c4 ref(chain): Refactor next_store_index (Daniela Brozzoni)

Pull request description:

  ### Description

  As a part of #1203, I found myself having to modify `reveal_to_target`, but had some troubles understanding exactly what the method was doing.

  This PR refactors `reveal_to_target` to be, in my opinion, a bit clearer. We now exist prematurely if `next_reveal_index` < `target_index`; this way, we don't need to keep track of `next_reveal_index`, as it would always be equal to `Some(target_index)`.
  As a part of trying to understand `reveal_to_target` I had to read through `next_store_index`, I slightly improved it for clarity reasons as well.

  ### 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)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

ACKs for top commit:
  evanlinjin:
    ACK 761189ab2b679fbfee45b33435d66ed98a135e2a

Tree-SHA512: 17f70bccbfa1cccf718ece0eeb61f4944c9108776cf1d606ef823ae9ff58bf52114750927ac99561644ece598f8131ee7f7605071d42c91e5e88e05035e74836

23 months agofeat(chain): debug_assert non-wildcard desc. to only cache index 0
志宇 [Tue, 9 Jan 2024 01:44:06 +0000 (09:44 +0800)]
feat(chain): debug_assert non-wildcard desc. to only cache index 0

23 months agofix(example_electrum): init LocalChain from genesis
vmammal [Tue, 28 Nov 2023 18:23:05 +0000 (13:23 -0500)]
fix(example_electrum): init LocalChain from genesis

23 months agoMerge bitcoindevkit/bdk#1263: Bump bdk_esplora and bdk_file_store versions for 1...
Steve Myers [Wed, 10 Jan 2024 01:22:58 +0000 (19:22 -0600)]
Merge bitcoindevkit/bdk#1263: Bump bdk_esplora and bdk_file_store versions for 1.0.0-alpha.3 release

8f6dad76efaa4af0ebb990ed83632f230fd10d94 Bump bdk_esplora and bdk_file_store versions for 1.0.0-alpha.3 release (Steve Myers)

Pull request description:

  ### Description

  These crates need to have their versions bumped because the version of bdk_chain was bumped to 0.7.0 with the 1.0.0-alpha.3 release.

  bdk_esplora to 0.5.0
  bdk_file_store to 0.3.0

  After this PR is merged I'll publish new versions of these crates to crates.io.

  ### Notes to the reviewers

  I should have done this as part of the 1.0.0-alpha.3 release process.  This problem was found when @thunderbiscuit started updating the bdk-ffi project to alpha.3 and we got type mismatch errors for bdk_chain types used in bdk_esplora.

ACKs for top commit:
  thunderbiscuit:
    ACK 8f6dad76efaa4af0ebb990ed83632f230fd10d94.

Tree-SHA512: 735094a5d78da082437118a38db085b12c26665c8cf8fd809d62dbe9a058ee04c59a165e454b3eb8baea4209330083a6a7bce8c303be1660f6593c80ccbe46b7

23 months agoBump bdk_esplora and bdk_file_store versions for 1.0.0-alpha.3 release
Steve Myers [Tue, 9 Jan 2024 21:05:55 +0000 (15:05 -0600)]
Bump bdk_esplora and bdk_file_store versions for 1.0.0-alpha.3 release

These crates need to have their versions bumped because the version of bdk_chain was bumped to 0.7.0 with the 1.0.0-alpha.3 release.

bdk_esplora to 0.5.0
bdk_file_store to 0.3.0

23 months agoref(chain): Refactor reveal_to_target
Daniela Brozzoni [Mon, 8 Jan 2024 13:47:28 +0000 (14:47 +0100)]
ref(chain): Refactor reveal_to_target

Simplify the `reveal_to_target` algorithm by exiting prematurely if
the `target_index` is already revealed.
Since the `reveal_to_index` variable was different from
`Some(target_index)` only if the target was already revealed, we can
getrid of the variable altogether.

23 months agoref(chain): Refactor next_store_index
Daniela Brozzoni [Mon, 8 Jan 2024 13:46:25 +0000 (14:46 +0100)]
ref(chain): Refactor next_store_index

Rename `v` to `index` for better clarity, and add a comment explaining
the `range`

23 months agoMerge bitcoindevkit/bdk#1161: ref(hwi): Move hwi out of bdk
Steve Myers [Mon, 8 Jan 2024 15:54:25 +0000 (09:54 -0600)]
Merge bitcoindevkit/bdk#1161: ref(hwi): Move hwi out of bdk

105d70e9743f651d141c6e0d901d60d583afd4d9 ref(hwi): Move hwi out of bdk (Daniela Brozzoni)

Pull request description:

  Fixes #872

  ### Description

  This commit moves the `hardwaresigner` outside of bdk and inside `bdk_hwi`

  ### Notes to the reviewers

  There are currently two issues with the code:
  - `TransactionSigner` dictates that `sign_transaction` must return a `SignerError` - but being `SignerError` defined inside of bdk, we can't modify it to include an hwi specific error! I don't know how we could fix this (other than getting rid of the trait altogether :)); for now I just added a `SignerError::Generic` variant, lmk if you have better ideas!
  - The hwi tests used the bdk utils to get a funded wallet for testing, which aren't available in `bdk_hwi`, which made me realize - maybe we should expose them so that we can use them across our crates, and also our users can use them to test their code?
  For now, I just left the test commented.

  ### Changelog notice

  - The old `hardwaresigner` module has been moved out of `bdk` and inside `bdk_hwi`.

  ### 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:
  notmandatory:
    reACK 105d70e9743f651d141c6e0d901d60d583afd4d9

Tree-SHA512: 9ae3cd035cc27bd7b2831e89c104f40771c6f165cb3bfe1a9052f820050fca7c19f4dd68f171c630a71a7d18ccdee5f94adbc497c6475bd257c2d01cc08109a1

23 months agoref(hwi): Move hwi out of bdk
Daniela Brozzoni [Mon, 9 Oct 2023 14:42:23 +0000 (16:42 +0200)]
ref(hwi): Move hwi out of bdk

Fixes #872

23 months agoMerge bitcoindevkit/bdk#1255: Bump bdk version to 1.0.0-alpha.3 v1.0.0-alpha.3
Steve Myers [Sun, 7 Jan 2024 16:50:20 +0000 (10:50 -0600)]
Merge bitcoindevkit/bdk#1255: Bump bdk version to 1.0.0-alpha.3

003271117cb347556cc82455558da40ef50a1156 Bump bdk version to 1.0.0-alpha.3 (Steve Myers)

Pull request description:

  ### Description

  - Bump bdk version to 1.0.0-alpha.3
  - Bump bdk_chain to 0.7.0
  - Bump bdk_bitcoin_rpc to 0.2.0
  - Bump bdk_electrum to 0.5.0

  ### Notes to the reviewers

  ### Changelog notice

  See #1254

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

Tree-SHA512: ac0756f52436880fe633e9ecb83f3d53f485ccfa89a3a89aa51ee4ba5da5cee87f507da69a9e1271f8aaf4425f65d04fb201ea9a4f64bce18f96039ea3548d61

23 months agoMerge bitcoindevkit/bdk#1259: Bump `bip39` dependency to v2.0
Steve Myers [Sun, 7 Jan 2024 16:36:13 +0000 (10:36 -0600)]
Merge bitcoindevkit/bdk#1259: Bump `bip39` dependency to v2.0

8694624bd5f63b738448c250d7b1042f219636da Bump `bip39` to v2.0 (Elias Rohrer)

Pull request description:

  We previously bumped the `bip39` version to 2.0 [in the 0.2X release branch](https://github.com/bitcoindevkit/bdk/pull/875). Back then, bumping it in `master` was [assumed unnecessary](https://github.com/bitcoindevkit/bdk/pull/875#issuecomment-1483990088). It seems this was erroneous, as the current `1.0.1` dependency is present since https://github.com/bitcoindevkit/bdk/pull/793, which was merged before the bump in `release/0.27`.

  Here, we therefore bump the crate version in `master` after all.

ACKs for top commit:
  notmandatory:
    ACK 8694624bd5f63b738448c250d7b1042f219636da

Tree-SHA512: a109219bc97bb8e965e8b10e72439aa898b710d1d1a154801ce499ad47475a6b23448d85e0de3f306f990573d1fccdae7d587ed41676a01f91d66a719782eae1

23 months agoBump `bip39` to v2.0
Elias Rohrer [Sun, 7 Jan 2024 16:08:30 +0000 (17:08 +0100)]
Bump `bip39` to v2.0

We previously bumped the `bip39` version to 2.0 in the 0.2X release
branch. Back then, bumping it in `master` was erroneously considered unnecessary.

Here, we therefore bump the crate version in `master` after all.

23 months agoBump bdk version to 1.0.0-alpha.3
Steve Myers [Wed, 3 Jan 2024 02:33:24 +0000 (20:33 -0600)]
Bump bdk version to 1.0.0-alpha.3

Bump bdk_chain to 0.7.0
Bump bdk_bitcoin_rpc to 0.2.0
Bump bdk_electrum to 0.5.0

23 months agoMerge bitcoindevkit/bdk#1258: fix(typos): existant -> existent
Steve Myers [Sat, 6 Jan 2024 20:24:26 +0000 (14:24 -0600)]
Merge bitcoindevkit/bdk#1258: fix(typos): existant -> existent

028caa9f8cd51afba0fdc81748fc8cf536c75cd0 fix(typos): existant -> existent (Jose Storopoli)

Pull request description:

  ### Description

  These typos are blocking the Nix typo CI in #1257

  ### Notes to the reviewers

  Blocking #1257

  ### Changelog notice

  - fix: typos in documentation
  -
  ### 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 028caa9f8cd51afba0fdc81748fc8cf536c75cd0

Tree-SHA512: 0bd91efd0eec55fdc537824435552c968858a5b827179b3f9f3f37785db3fa92d3e6f0c73023de0c506224c81217c402d5afa8a2f768fecaf6a3c8378226d184

23 months agofix(typos): existant -> existent
Jose Storopoli [Sat, 6 Jan 2024 17:13:56 +0000 (14:13 -0300)]
fix(typos): existant -> existent

These typos are blocking the Nix typo CI in #1257

23 months agoMerge bitcoindevkit/bdk#1256: cherry-pick feat(wallet)!: add `NonEmptyDatabase` varia...
志宇 [Sat, 6 Jan 2024 05:30:17 +0000 (13:30 +0800)]
Merge bitcoindevkit/bdk#1256: cherry-pick feat(wallet)!: add `NonEmptyDatabase` variant to `NewError`

a1d34afa2455d93d23a36fd78d94aa79c7e493d1 feat(wallet)!: add `NonEmptyDatabase` variant to `NewError` (志宇)

Pull request description:

  ### Description

  `NewError` is the error type when constructing a wallet with `Wallet::new`. We want this to return an error when the database already contains data (in which case, the caller should use `load` or `new_or_load`).

  ### Notes to the reviewers

  This is cherry-picked from #1172 so that we can add it to the alpha.3 release.

  ### Changelog notice

  Change
  - Return `NonEmptyDatabase` error when constructing a wallet with `Wallet::new` if the file already contains data (in which case, the caller should use `load` or `new_or_load`).

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

Tree-SHA512: 7c20171fa3d7dee5b1ac24f8a808781dbb0be0034951005e1e87acdf023123c01161e225b47b6d4484865889778c39549a3780f641227ddc0f84d1577d69f40a

23 months agofeat(wallet)!: add `NonEmptyDatabase` variant to `NewError`
志宇 [Tue, 2 Jan 2024 05:03:19 +0000 (13:03 +0800)]
feat(wallet)!: add `NonEmptyDatabase` variant to `NewError`

`NewError` is the error type when constructing a wallet with
`Wallet::new`. We want this to return an error when the database already
contains data (in which case, the caller should use `load` or
`new_or_load`).

23 months agoMerge bitcoindevkit/bdk#1235: Refactor/rename electrum_ext and esplora_ext to have...
Steve Myers [Sat, 6 Jan 2024 03:39:22 +0000 (21:39 -0600)]
Merge bitcoindevkit/bdk#1235: Refactor/rename electrum_ext and esplora_ext to have sync and full_scan functions

de54e710ed04e3cb1632cf99dbc1c6f2374b0c6e refactor(esplora_ext): rename scan_txs to sync and scan_txs_with_keychains to full_scan (Steve Myers)
95d34854f46fd154eed35008954b25b82785b2d8 refactor(electrum_ext): rename scan_without_keychain to sync and scan to full_scan (Steve Myers)

Pull request description:

  ### Description

  fixes #1112

  Simple function renaming plus updated docs:

  1. electrum_ext: rename functions `scan_without_keychain` to `sync` and `scan` to `full_scan`
  2. esplora_ext: rename functions `scan_txs` to `sync` and `scan_txs_with_keychains` to `full_scan`

  ### Notes to the reviewers

  The esplora_ext changes were partially fixed in #1070 but I renamed again so the functions match names ~~suggested in #1112~~ agreed on in discord poll, `sync` and `full_scan`.

  ### Changelog notice

  Changed

  - electrum_ext: rename functions scan_without_keychain to sync and scan to full_scan
  - esplora_ext: rename functions scan_txs to sync and scan_txs_with_keychains to full_scan

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

23 months agorefactor(esplora_ext): rename scan_txs to sync and scan_txs_with_keychains to full_scan
Steve Myers [Thu, 7 Dec 2023 03:21:02 +0000 (21:21 -0600)]
refactor(esplora_ext): rename scan_txs to sync and scan_txs_with_keychains to full_scan

removed txids and outpoints params from full_scan

23 months agorefactor(electrum_ext): rename scan_without_keychain to sync and scan to full_scan
Steve Myers [Thu, 7 Dec 2023 03:14:16 +0000 (21:14 -0600)]
refactor(electrum_ext): rename scan_without_keychain to sync and scan to full_scan

removed txids and outpoints params from full_scan

23 months agoConsolidate `calc_checksum_bytes_internal` routine
Sebastian Falbesoner [Tue, 2 Jan 2024 03:09:45 +0000 (04:09 +0100)]
Consolidate `calc_checksum_bytes_internal` routine

Now that the deprecated `get_checksum{,_bytes}` routines are removed,
the checksum is always computed with ignored data after the first '#',
i.e. the boolean parameter `exclude_hash` is not needed anymore and
the functionality can be consolidated into `calc_checksum_bytes`.

23 months agoRemove deprecated `get_checksum{,_bytes}` routines
Sebastian Falbesoner [Tue, 2 Jan 2024 02:55:43 +0000 (03:55 +0100)]
Remove deprecated `get_checksum{,_bytes}` routines

There are deprecated since 0.24.0, i.e. they can be removed now.

23 months agoMerge bitcoindevkit/bdk#1229: Use a universal lookahead value for `KeychainTxOutIndex...
志宇 [Fri, 29 Dec 2023 12:38:53 +0000 (20:38 +0800)]
Merge bitcoindevkit/bdk#1229: Use a universal lookahead value for `KeychainTxOutIndex` and have a reasonable default

1def76f1f17fc876534c798883099c58de57c0fd chore: make clippy happy and bump clippy msrv (志宇)
c9467dcbb27bd497006846dcfcefb0c2cf8823c4 chore: improve documentation of lookahead (LLFourn)
bc796f412acdc3d2cd96f7aec0f24fa47c1fe889 fix(example): bitcoind_rpc_polling now initializes local_chain properly (志宇)
4fd539b6470f7f771e3b5e09e3287952fa7a1825 feat(chain)!: `KeychainTxOutIndex` uses a universal lookahead (Antoine Poinsot)

Pull request description:

  ### Description

  The `bdk::Wallet` is currently created without setting any lookahead value for the keychain. This implicitly makes it a lookahead of 0. As this is a high-level interface we should avoid footguns and aim for a reasonable default.

  To fix this, we have also decided to change `KeychainTxOutIndex` to have a default lookahead. Additionally, we have simplified the `KeychainTxOutIndex` API to have a single `lookahead` that is ONLY set at construction `KeychainTxOutIndex::new(lookahead: u32) -> Self`. This avoids the footguns of having methods which allows the caller to decrease the `lookahead` (which will panic).

  ### Notes to the reviewers

  ~A way to set this value externally is introduced in #1172. This PR only aims to use a saner default than 0. `1_000` is the value used by the Bitcoin Core wallet, and that seems reasonable to me.~

  Edit: we should NOT allow setting the `lookahead` value after-the-fact. Instead, the `lookahead` should be provided to the wallet's constructor.

  @evanlinjin: I don't think additional tests are necessary as no additional features are added, and the surface area of the API is decreased. The original tests already thoroughly test the `lookahead` concept.

  ### Checklists

  #### All Submissions:

  *(This section was updated as this PR changed from being a simple setting to introducing a new method.)*

  * [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
  ~* [ ] I've added tests~
  * [x] I've added docs

ACKs for top commit:
  LLFourn:
    ACK 1def76f1f17fc876534c798883099c58de57c0fd

Tree-SHA512: b4c3be8a4f2ac4877cf3f05852147e7dd1daeb02d3bc40895f02fd2a58e584f1dc0735b524153ff0875380ac93c0b4c31e516873d7a9b0027fdbbb5fe7970ff2

23 months agochore: make clippy happy and bump clippy msrv
志宇 [Fri, 29 Dec 2023 11:15:57 +0000 (19:15 +0800)]
chore: make clippy happy and bump clippy msrv

23 months agochore: improve documentation of lookahead
LLFourn [Fri, 29 Dec 2023 05:40:48 +0000 (16:40 +1100)]
chore: improve documentation of lookahead

23 months agofix(example): bitcoind_rpc_polling now initializes local_chain properly
志宇 [Thu, 28 Dec 2023 04:49:04 +0000 (12:49 +0800)]
fix(example): bitcoind_rpc_polling now initializes local_chain properly

Previously, the genesis block is not initialized properly. Thank you
@notmandatory for identifying this bug.

23 months agofeat(chain)!: `KeychainTxOutIndex` uses a universal lookahead
Antoine Poinsot [Tue, 28 Nov 2023 17:08:49 +0000 (18:08 +0100)]
feat(chain)!: `KeychainTxOutIndex` uses a universal lookahead

The wallet is currently created without setting any lookahead value for
the keychain. This implicitly makes it a lookahead of 0. As this is a
high-level interface we should avoid footguns and aim for a reasonable
default.

Instead of simply patching it for wallet, we alter `KeychainTxOutIndex`
to have a default lookahead value. Additionally, instead of a
per-keychain lookahead, the constructor asks for a `lookahead` value.
This avoids the footguns of having methods which allows the caller the
decrease the `lookahead` (and therefore panicing). This also simplifies
the API.

Co-authored-by: Antoine Poisot <darosior@protonmail.com>
Co-authored-by: 志宇 <hello@evanlinjin.me>
23 months agoMerge bitcoindevkit/bdk#1246: Fix: apply loaded changeset to indexed_graph when loadi...
志宇 [Tue, 26 Dec 2023 04:13:42 +0000 (12:13 +0800)]
Merge bitcoindevkit/bdk#1246: Fix: apply loaded changeset to indexed_graph when loading a wallet from persistence

f4863c6314904ddd5da586fed0abb8f04ccee396 fix(wallet): apply loaded changeset to indexed_graph (thunderbiscuit)

Pull request description:

  ### Description
  This PR applies the tx_graph from the changeset when loading a wallet from persistence. This ensures among other things that the revealed keychain indices get picked up by the new wallet. A test for this has been added/modified from an old test.

  ### Notes to the reviewers

  ### Changelog notice
  Fix: loading a wallet from persistence now restores keychain indices.

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

Tree-SHA512: c8502077ba25e6fb953829b020b396774aa0569f7272e7818f30ddabed9d1d8ce791729bebc92b9ec1059028399495cb79ea147cf900f25aace94045dd7290a6

2 years agofix(wallet): apply loaded changeset to indexed_graph
thunderbiscuit [Tue, 19 Dec 2023 21:05:01 +0000 (16:05 -0500)]
fix(wallet): apply loaded changeset to indexed_graph

2 years agoMerge bitcoindevkit/bdk#1247: ci: pin home dependency to 0.5.5 and check_clippy to...
志宇 [Thu, 21 Dec 2023 02:41:46 +0000 (10:41 +0800)]
Merge bitcoindevkit/bdk#1247: ci: pin home dependency to 0.5.5 and check_clippy to rust stable version

e7fbc8bcf36de110e88095dba8be0c62e2c8e0ef ci: run clippy_check with rust stable (Steve Myers)
2251b8d41661deb5d8ef7b98abef55efe6437180 ci: pin home version to 0.5.5 for 1.63 MSRV (Steve Myers)

Pull request description:

  ### Description

  Fixed 1.63 MSRV error by pinning `home` dependency to `0.5.5`, and `clippy` error by changing `check_clippy` job to using rust `stable` version.

  ### Notes to the reviewers

  It's OK to use rust `stable` version for clippy because we already have a `clippy.toml` file to tell it which version of the clippy rules to check against.

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

ACKs for top commit:
  evanlinjin:
    ACK e7fbc8bcf36de110e88095dba8be0c62e2c8e0ef

Tree-SHA512: 4e9e12488d44a940ea80ecc32ae74dade13d04d5088cb2206271401a2d77b56407af36482df952354b187a52b83631dcdf53bd60d9084a910f4be278059df93b

2 years agoci: run clippy_check with rust stable
Steve Myers [Wed, 20 Dec 2023 17:23:34 +0000 (11:23 -0600)]
ci: run clippy_check with rust stable

2 years agoci: pin home version to 0.5.5 for 1.63 MSRV
Steve Myers [Wed, 20 Dec 2023 17:19:48 +0000 (11:19 -0600)]
ci: pin home version to 0.5.5 for 1.63 MSRV

2 years agoMerge bitcoindevkit/bdk#1188: doc: Improve TxGraph & co docs
Steve Myers [Wed, 13 Dec 2023 22:53:55 +0000 (16:53 -0600)]
Merge bitcoindevkit/bdk#1188: doc: Improve TxGraph & co docs

0adff9c35f109a15740212b4dce74c03950c85ed doc: Improve TxGraph & co docs (Daniela Brozzoni)

Pull request description:

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

Tree-SHA512: 83adffeddf6c8ddb7b5e57a0fa2e5cffaf75cdeea59be0a6c5e94dcd5a7f98328db8e2a620edc753e60ea3382282908c75d34783a280348cfd105a37982c762b

2 years agodoc: Improve TxGraph & co docs
Daniela Brozzoni [Tue, 17 Oct 2023 09:00:05 +0000 (11:00 +0200)]
doc: Improve TxGraph & co docs

2 years agoMerge bitcoindevkit/bdk#1183: Bump MSRV to 1.63.0
Steve Myers [Tue, 12 Dec 2023 02:06:47 +0000 (20:06 -0600)]
Merge bitcoindevkit/bdk#1183: Bump MSRV to 1.63.0

169385bb5ba0fe6ad3ed4fbbad431904582c7eb7 ci: change MSRV to 1.63.0 (Steve Myers)

Pull request description:

  ### Description

  fixes #331

  ### Notes to the reviewers

  We won't merge this PR until LDK merges lightningdevkit/rust-lightning#2681.

  There are alot of clippy checks to fix at 1.63.0 so I left the clippy MSRV at 1.57.0 for now.

  ### Changelog notice

  Changed

  - MSRV is now 1.63.0 for bdk, chain, and bitcoind_rpc crates

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

Tree-SHA512: ad69038173b4f050b57f637fc06a4153cf76929992cfea77e3f25d1e66be102bd2f83a46401a7e3245e9cc54602210c95b75a578f18c5c8b55d1e7229e92197f

2 years agoci: change MSRV to 1.63.0
Steve Myers [Wed, 25 Oct 2023 02:55:19 +0000 (21:55 -0500)]
ci: change MSRV to 1.63.0

2 years agoMerge bitcoindevkit/bdk#1158: doc(bdk): Clarify the absolute_fee docs
Steve Myers [Tue, 5 Dec 2023 13:15:06 +0000 (07:15 -0600)]
Merge bitcoindevkit/bdk#1158: doc(bdk): Clarify the absolute_fee docs

0ecc0280c032301dc638e75e54a8691d66d50274 doc(bdk): Clarify the absolute_fee, fee_rate docs (Daniela Brozzoni)

Pull request description:

  Fixes #1066

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

Tree-SHA512: 152e48b86c21d4fad711abf76dd8fdc0e8955030331005c1ba6ff0c866c52870161f91ec740838f8238c5ad1c620e06212099308a55d130699cb18e4666e3f3f

2 years agoMerge bitcoindevkit/bdk#1179: build(esplora): Add async-https-rustls flag to esplora...
Steve Myers [Tue, 5 Dec 2023 04:21:33 +0000 (22:21 -0600)]
Merge bitcoindevkit/bdk#1179: build(esplora): Add async-https-rustls flag to esplora client

6817ca9bcbff957efb58f96886a30b6bd87c0cde ci: pin hyper-rustls version to 0.24.0 for 1.57 MSRV (thunderbiscuit)
4ee41dbc402121d14ffa099863bf35329851c1e4 build(esplora): Add async-https-rustls flag to esplora client (thunderbiscuit)

Pull request description:

  ### Description
  The bdk_esplora crate currently doesn't expose the [`async-https-rustls` flag offered by the rust-esplora-client](https://github.com/bitcoindevkit/rust-esplora-client/blob/ef1925e1ee1b951f15a9339282858bea27c6168f/Cargo.toml#L44) crate and instead requires users to build using the `default-tls` flag on reqwest, which uses the platform-specific openssl library when compiling. This creates complications for cross-compilation, notably for our Android builds that currently support 3 architectures (`arm64-v8a`, `armeabi-v7a`, and `x86_64`). In order to solve this we can either compile the openssl libraries for each of the platforms we want to support, or use the rustls-tls version of reqwest. The second options is much easier and requires less fiddling with the internals of the Android native development kit and cross-compilation rabbit holes.

  Before we merge this I want to make sure I understand the tradeoffs between the `native-tls` and the `rustls-tls` and confirm that there are not potential issues there, but from what I understand they should provide the same functionality/security, and because these are already available/exposed in reqwest and rust-esplora-client, I think this should be a fairly straightforward additional feature we offer.

  ### Changelog notice
  ```txt
  Added:
    - New async-https-rustls feature flag for the bdk_esplora crate, allowing to compile rust-esplora-client using rustls-tls instead of the default native-tls.
  ```

  ### 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 6817ca9bcbff957efb58f96886a30b6bd87c0cde
  realeinherjar:
    ACK https://github.com/bitcoindevkit/bdk/commit/6817ca9bcbff957efb58f96886a30b6bd87c0cde
  danielabrozzoni:
    ACK 6817ca9bcbff957efb58f96886a30b6bd87c0cde

Tree-SHA512: 1d417da7cf85e157d71f56442a06e817e8741822d7bff9089f7fbb70ff8b4854f1f52befbc348b849e9c98cae848b792d426cd5bf551e7a9089b15467d28efdd

2 years agoMerge bitcoindevkit/bdk#1225: esplora: fix incorrect gap limit check in blocking...
志宇 [Mon, 27 Nov 2023 01:40:31 +0000 (09:40 +0800)]
Merge bitcoindevkit/bdk#1225: esplora: fix incorrect gap limit check in blocking client

43aed386bc33f8dfca53ea2ec166dea1ce3d42d3 esplora: also test the gap limit bounds in the async client (Antoine Poinsot)
cb713e5b8c74181518e8cfcd4095c862bc73f014 esplora: also fix the gap limit check in the async client (Antoine Poinsot)
2c4e90a76fea51cb7381242f55b1ca0f02e20d4e esplora: scan gap limit bounds testing (Antoine Poinsot)
18bd3296170e64aee6870cd96dde52a0078bbcb1 esplora: fix incorrect gap limit check in blocking client (Antoine Poinsot)

Pull request description:

  The gap limit was checked such as if the last_index was not None but the last_active_index was, we'd consider having reached it. But the last_index is never None for this check. This effectively made it so the gap limit was always 1: if the first address isn't used last_active_index will be None and we'd return immediately.

  Fix this by avoiding error-prone Option comparisons and correctly checking we've reached the gap limit before breaking out of the loop.

ACKs for top commit:
  danielabrozzoni:
    ACK 43aed386bc33f8dfca53ea2ec166dea1ce3d42d3
  evanlinjin:
    ACK 43aed386bc33f8dfca53ea2ec166dea1ce3d42d3

Tree-SHA512: c6a172e0627380add56aec79e7fe36c0358e092b59f0bea8885d3524e65c10336291943efe6aeb5cc83f90c4f2146ed63215e56e08583d703b6ab57284487f03

2 years agoesplora: also test the gap limit bounds in the async client
Antoine Poinsot [Mon, 20 Nov 2023 11:00:50 +0000 (12:00 +0100)]
esplora: also test the gap limit bounds in the async client

2 years agoesplora: also fix the gap limit check in the async client
Antoine Poinsot [Mon, 20 Nov 2023 11:00:31 +0000 (12:00 +0100)]
esplora: also fix the gap limit check in the async client

2 years agoesplora: scan gap limit bounds testing
Antoine Poinsot [Mon, 20 Nov 2023 10:52:30 +0000 (11:52 +0100)]
esplora: scan gap limit bounds testing

2 years agoesplora: fix incorrect gap limit check in blocking client
Antoine Poinsot [Mon, 20 Nov 2023 09:34:10 +0000 (10:34 +0100)]
esplora: fix incorrect gap limit check in blocking client

The gap limit was checked such as if the last_index was not None but the
last_active_index was, we'd consider having reached it. But the
last_index is never None for this check. This effectively made it so the
gap limit was always 1: if the first address isn't used
last_active_index will be None and we'd return immediately.

Fix this by avoiding error-prone Option comparisons and correctly
checking we've reached the gap limit before breaking out of the loop.

2 years agoMerge bitcoindevkit/bdk#1190: Add `Wallet::list_output` method
Daniela Brozzoni [Tue, 21 Nov 2023 15:53:50 +0000 (16:53 +0100)]
Merge bitcoindevkit/bdk#1190: Add `Wallet::list_output` method

278210bb8918923005e80968df3dfcc3372c0a5c docs(bdk): clarify `insert_txout` docs (志宇)
6fb45d8a735ec8db9142489d86107de192e0fa9c test(bdk): add `test_list_output` (志宇)
e803ee901002cae4db5ebf3544eb42c6cf81e5e2 feat(bdk): add `Wallet::list_output` method (志宇)
82632897aaa4ea0ac24803f58fbd13d6dc9c4357 refactor(bdk)!: rename `LocalUtxo` to `LocalOutput` (志宇)

Pull request description:

  Fixes #1184

  ### Description

  Introduce `Wallet::list_output` method that lists all outputs (both spent and unspent) in a consistent history.

  ### Changelog notice

  - Rename `LocalUtxo` to `LocalOutput`.
  - Add `Wallet::list_output` method.

  ### 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:
    re-ACK 278210bb8918923005e80968df3dfcc3372c0a5c
  danielabrozzoni:
    ACK 278210bb8918923005e80968df3dfcc3372c0a5c

Tree-SHA512: 151af0e05e55d9c682271ef0c7a82e189531db963f65aa62c2ba0507f203dde39ab7561521c56e72c26830828e94ff96b7bd7e3f46082b23f79c5e0f89470136

2 years agoci: pin hyper-rustls version to 0.24.0 for 1.57 MSRV
thunderbiscuit [Tue, 21 Nov 2023 01:02:31 +0000 (20:02 -0500)]
ci: pin hyper-rustls version to 0.24.0 for 1.57 MSRV

2 years agoMerge bitcoindevkit/bdk#1204: chore: remove bdk dependency on log and dev dependency...
Steve Myers [Mon, 20 Nov 2023 23:33:48 +0000 (15:33 -0800)]
Merge bitcoindevkit/bdk#1204: chore: remove bdk dependency on log and dev dependency on env_logger

02fa34089623ea43e9c62003e3b829d10dec5a14 chore: remove bdk dependency on log and dev dependency on env_logger (Steve Myers)

Pull request description:

  ### Description

  As suggested by @TheBlueMatt we shouldn't use the `log` crate because even though it is a rust-lang project is may depend on some other crates that aren't as well maintained. Since we were only use `log` in a few places and not it any other bdk workspace projects except the `bdk` package I removed it.

  ### Notes to the reviewers

  For consistency I also removed the `env_logger` from the dev dependencies since it was only being used in a few places in a couple examples and println! is adequate for examples.

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

Top commit has no ACKs.

Tree-SHA512: beb9e4d465112090093590c45e3e5e2286a99a819312512eb3e5b40d0eade9740314bb8e45a2ad3fa0a4c86e32711d2ef8f966842815874b9315fd0b63bc7283

2 years agochore: remove bdk dependency on log and dev dependency on env_logger
Steve Myers [Sat, 11 Nov 2023 19:02:02 +0000 (13:02 -0600)]
chore: remove bdk dependency on log and dev dependency on env_logger

2 years agobuild(esplora): Add async-https-rustls flag to esplora client
thunderbiscuit [Mon, 16 Oct 2023 16:56:19 +0000 (12:56 -0400)]
build(esplora): Add async-https-rustls flag to esplora client

2 years agodocs(bdk): clarify `insert_txout` docs
志宇 [Mon, 20 Nov 2023 21:06:53 +0000 (05:06 +0800)]
docs(bdk): clarify `insert_txout` docs

Inserted txouts will not be shown in `list_unspent` or `list_output`.

2 years agotest(bdk): add `test_list_output`
志宇 [Wed, 1 Nov 2023 20:24:25 +0000 (04:24 +0800)]
test(bdk): add `test_list_output`

2 years agofeat(bdk): add `Wallet::list_output` method
志宇 [Wed, 1 Nov 2023 05:25:28 +0000 (13:25 +0800)]
feat(bdk): add `Wallet::list_output` method

2 years agorefactor(bdk)!: rename `LocalUtxo` to `LocalOutput`
志宇 [Wed, 1 Nov 2023 04:33:57 +0000 (12:33 +0800)]
refactor(bdk)!: rename `LocalUtxo` to `LocalOutput`

2 years agoMerge bitcoindevkit/bdk#1028: Add CreateTxError and use as error type for TxBuilder...
Steve Myers [Thu, 16 Nov 2023 18:30:16 +0000 (12:30 -0600)]
Merge bitcoindevkit/bdk#1028: Add CreateTxError and use as error type for TxBuilder::finish()

00ec19ef2d59b6268424105f3d1947ab637b8c0c ci: fix MSRV pinning for rustls 0.21.9 (Steve Myers)
77f9977c02683071748f5fd6d07bde4b2d1f4a12 feat(wallet): Add infallible Wallet get_address(), get_internal_address functions (Steve Myers)
9e7d99e3bf9687251930c9a6bc5f1fe6a7c78bcb refactor(bdk)!: add context specific error types, remove top level error mod (Steve Myers)

Pull request description:

  ### Description

  To remove some places where there were `.expect("TODO")` I added a new `CreateTxError` type which is returned from `TxBuilder::finish()`. I also updated related tests and doc tests.

  Fixes https://github.com/bitcoindevkit/bdk/issues/996#issuecomment-1621036206

  Also added fallible `Wallet::try_get_address()` and `try_get_internal_address()`  to return `Result` with a possible `D:WriteError` when a PersistBackend is used. This should fix #996.

  I removed catch-all bdk::Error and replaced usages with new types and updated related functions, fixes #994.

  ### Notes to the reviewers

  ~~I didn't add all possible bdk::Error types that `Wallet::create_tx()` and `TxBuilder::finish()` functions might throw. It's probably not too much more work but will take a bit more research so I want to make sure this is the right general approach first.~~

  I added `anyhow` to the dev-dependencies so I could remove some `.expect()` lines from the docs tests and make the examples closer to what an end user should do.  I also used the `anyhow!()` macro to replace a few places that were using the `bdk::Error::Generic` in example code.

  I also moved the module level error.rs file to wallet/error.rs so no one would be tempted to make any new catch all errors and to make it clear that all the errors in it are wallet module related.

  ### Changelog notice

  Changed

  - Updated bdk module to use new context specific error types
    - wallet: MiniscriptPsbtError, CreateTxError, BuildFeeBumpError error enums
    - coin_selection: module Error enum
  - Renamed fallible Wallet address functions to try_get_address() and try_get_internal_address()

  Removed

  - Removed catch-all top level bdk::Error enum
  - Removed impl_error macro

  Added

  -  Added infallible Wallet get_address(), get_internal_address functions

  ### 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
  * [ ] I'm linking the issue being fixed by this PR

Top commit has no ACKs.

Tree-SHA512: a87c0856d71f9c945d12b6de6d368f49bd62d73886ac46ac83d00ddb81f2c38c5233ba053e40c76dea73ee7bfc19dac510eec5d7c9026ae50a2dc7308ac4786f

2 years agoci: fix MSRV pinning for rustls 0.21.9
Steve Myers [Thu, 16 Nov 2023 17:56:09 +0000 (11:56 -0600)]
ci: fix MSRV pinning for rustls 0.21.9

2 years agofeat(wallet): Add infallible Wallet get_address(), get_internal_address functions
Steve Myers [Thu, 16 Nov 2023 17:18:11 +0000 (11:18 -0600)]
feat(wallet): Add infallible Wallet get_address(), get_internal_address functions

refactor!(wallet)!: rename fallible Wallet try_get_address(), try_get_internal_address functions

2 years agorefactor(bdk)!: add context specific error types, remove top level error mod
Steve Myers [Thu, 16 Nov 2023 16:22:37 +0000 (10:22 -0600)]
refactor(bdk)!: add context specific error types, remove top level error mod

refactor(bdk)!: remove impl_error macro
refactor(wallet)!: add MiniscriptPsbtError, CreateTxError, BuildFeeBumpError error enums
refactor(coin_selection)!: add module Error enum
test(bdk): use anyhow dev-dependency for all tests