]> Untitled Git - bdk/log
bdk
18 months agoMerge bitcoindevkit/bdk#1450: Bump bdk version to 1.0.0-alpha.12 v1.0.0-alpha.12
Steve Myers [Thu, 23 May 2024 22:33:27 +0000 (17:33 -0500)]
Merge bitcoindevkit/bdk#1450: Bump bdk version to 1.0.0-alpha.12

108061dddbba99f03d7416a673135211ef94043b Bump bdk version to 1.0.0-alpha.12 (Steve Myers)

Pull request description:

  ### Description

  fixes #1449

  bdk_chain to 0.15.0
  bdk_bitcoind_rpc to 0.11.0
  bdk_electrum to 0.14.0
  bdk_esplora to 0.14.0
  bdk_persist to 0.3.0
  bdk_file_store to 0.12.0
  bdk_sqlite keep at 0.1.0
  bdk_testenv to 0.5.0
  bdk_hwi to 0.1.0
  bdk_wallet to 1.0.0-alpha.12

  ### Notes to the reviewers

  I also (hopefully) fixed the `bdk_hwi` crate so it can be published.

ACKs for top commit:
  ValuedMammal:
    ACK 108061dddbba99f03d7416a673135211ef94043b
  storopoli:
    ACK 108061dddbba99f03d7416a673135211ef94043b

Tree-SHA512: 2a80c51e254ca011b8e9bb72ad3d720dd8d09a3142e85cf230ffffad747257d91c45950cce64b049bab91f21c70c622f14d46def24ea78459497b42472a1fe48

18 months agoBump bdk version to 1.0.0-alpha.12
Steve Myers [Thu, 23 May 2024 16:15:30 +0000 (11:15 -0500)]
Bump bdk version to 1.0.0-alpha.12

bdk_chain to 0.15.0
bdk_bitcoind_rpc to 0.11.0
bdk_electrum to 0.14.0
bdk_esplora to 0.14.0
bdk_persist to 0.3.0
bdk_file_store to 0.12.0
bdk_sqlite keep at 0.1.0
bdk_testenv to 0.5.0
bdk_hwi to 0.1.0
bdk_wallet to 1.0.0-alpha.12

18 months agoMerge bitcoindevkit/bdk#1393: fix(export): add tr descriptor
Steve Myers [Thu, 23 May 2024 15:12:56 +0000 (10:12 -0500)]
Merge bitcoindevkit/bdk#1393: fix(export): add tr descriptor

1b7c6df569a0ff9324bbda1f066938490109481d fix(export): add tr descriptor (rustaceanrob)

Pull request description:

  ### Description

  Resolves #860 by adding export of taproot descriptors

  ### Notes to the reviewers

  Allows export as Core accepts taproot.

  ### Changelog notice

  - Export taproot descriptors

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

  #### New Features:

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

  #### Bugfixes:

  * [ ] This pull request breaks the existing API
  * [ ] I've added tests to reproduce the issue which are now passing
  * [x] I'm linking the issue being fixed by this PR

ACKs for top commit:
  notmandatory:
    ACK 1b7c6df569a0ff9324bbda1f066938490109481d

Tree-SHA512: 80bee93a1ec531717e79a5e7a91e840532ae4d3daf677a207bc53162c69410e47db4893024b3eccfd848f1628062e7c49f0e92ebeb7230e2ebb9b47eb84b9e56

18 months agoMerge bitcoindevkit/bdk#1386: Remove TxBuilder allow_shrinking() and unneeded context...
Steve Myers [Thu, 23 May 2024 15:01:44 +0000 (10:01 -0500)]
Merge bitcoindevkit/bdk#1386: Remove TxBuilder allow_shrinking() and unneeded context param

096b8ef781b21e7da690b9ca2e4b326880d6ac0b fix(wallet): remove TxBuilder::allow_shrinking function and TxBuilderContext (Steve Myers)

Pull request description:

  ### Description

  Remove wallet::TxBuilder::allow_shrinking() and unneeded TxBuilder context param.

  Fixes #1374

  ### Notes to the reviewers

  The allow_shrinking function was the only one using the TxBuilder FeeBump context and it's useful to have CreateTx context  functions available for building FeeBump transactions, see updated tests.

  ### Changelog notice

  Changed

  - Removed TxBuilder::allow_shrinking() function.

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

  #### Bugfixes:

  * [x] This pull request breaks the existing API
  * [ ] I've added tests to reproduce the issue which are now passing
  * [x] I'm linking the issue being fixed by this PR

Top commit has no ACKs.

Tree-SHA512: f4f05ce4cfaced9e61eebc0ebfe77a299fae13df4459fc26c90657297a1347a5d16f22b4e1c8b9b10458cfec80ca3b5d698eee11c7a560fd83f94a1ac7101a86

18 months agofix(wallet): remove TxBuilder::allow_shrinking function and TxBuilderContext
Steve Myers [Fri, 17 May 2024 02:47:56 +0000 (21:47 -0500)]
fix(wallet): remove TxBuilder::allow_shrinking function and TxBuilderContext

18 months agoMerge bitcoindevkit/bdk#1128: feat: add bdk_sqlite crate implementing PersistBackend
志宇 [Thu, 23 May 2024 14:33:05 +0000 (22:33 +0800)]
Merge bitcoindevkit/bdk#1128: feat: add bdk_sqlite crate implementing PersistBackend

475c5024ecc5d288f35fabb8fab2b62dbf67653b feat(sqlite): add bdk_sqlite crate implementing PersistBackend backed by a SQLite database (Steve Myers)
b8aa76cd050bc3c2eac776ecbd9b4e2ab3e2590e feat(wallet): use the new `CombinedChangeSet` of `bdk_persist` (志宇)
0958ff56b20c1325a7da5d5f21e7ac836c601f1f feat(persist): introduce `CombinedChangeSet` (志宇)
54942a902d3203ee59731f35d2a1c402ac626878 ci: bump build_docs rust version to nightly-2024-05-12 (Steve Myers)
d975a48e7c519a703441e74058321021957b177f docs: update README MSRV pinning to match CI (Steve Myers)

Pull request description:

  ### Description

  Add "bdk_sqlite_store" crate implementing `PersistBackend` backed by a SQLite database.

  ### Notes to the reviewers

  In addition to adding a SQLite based `PersistenceBackend` this PR also:

  * add  `CombinedChangeSet` in `bdk_persist` and update `wallet` crate to use it.
  * updates the `wallet/tests` to also use this new sqlite store crate.
  * updates `example-crates/wallet_esplora_async` to use this new sqlite store crate.
  * fixes out of date README instructions for MSRV.
  * bumps the ci `build_docs` job to rust `nightly-2024-05-12`.

  ### Changelog notice

  Changed

  - Update Wallet to use CombinedChangeSet for persistence.

  Added

  - Add  CombinedChangeSet in bdk_persist crate.
  - Add bdk_sqlite crate implementing SQLite based PersistenceBackend storage for CombinedChangeSet.

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

  #### New Features:

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

ACKs for top commit:
  evanlinjin:
    ACK 475c5024ecc5d288f35fabb8fab2b62dbf67653b

Tree-SHA512: 72565127994fbfff34d7359e1d36d6f13e552995bb7ea61dd38ba5329b0d15e500fa106214a83fd870f1017dc659ff1bb8fc71bc6aad0a793730ec7f23179d8c

18 months agofeat(sqlite): add bdk_sqlite crate implementing PersistBackend backed by a SQLite...
Steve Myers [Tue, 19 Sep 2023 22:29:23 +0000 (17:29 -0500)]
feat(sqlite): add bdk_sqlite crate implementing PersistBackend backed by a SQLite database

18 months agofeat(wallet): use the new `CombinedChangeSet` of `bdk_persist`
志宇 [Tue, 21 May 2024 14:30:07 +0000 (22:30 +0800)]
feat(wallet): use the new `CombinedChangeSet` of `bdk_persist`

18 months agofeat(persist): introduce `CombinedChangeSet`
志宇 [Tue, 21 May 2024 13:08:40 +0000 (21:08 +0800)]
feat(persist): introduce `CombinedChangeSet`

It is a good idea to have common changeset types stored in
`bdk_persist`. This will make it convenient for persistence crates and
`bdk_wallet` interaction.

18 months agoci: bump build_docs rust version to nightly-2024-05-12
Steve Myers [Tue, 14 May 2024 15:15:51 +0000 (10:15 -0500)]
ci: bump build_docs rust version to nightly-2024-05-12

18 months agodocs: update README MSRV pinning to match CI
Steve Myers [Thu, 9 May 2024 00:13:03 +0000 (19:13 -0500)]
docs: update README MSRV pinning to match CI

19 months agoMerge bitcoindevkit/bdk#1443: fix(electrum): Fix `fetch_prev_txout`
志宇 [Wed, 15 May 2024 12:34:47 +0000 (20:34 +0800)]
Merge bitcoindevkit/bdk#1443: fix(electrum): Fix `fetch_prev_txout`

af15ebba94f6d96a4d266fbbdee7c49150f80b96 fix(electrum): Fix `fetch_prev_txout` (valued mammal)

Pull request description:

  Previously we inserted every `TxOut` of a previous tx at the same outpoint, which is incorrect because an outpoint only points to a single `TxOut`. Now just get the `TxOut` corresponding to the txin prevout and insert it with its outpoint.

  ### Notes to the reviewers

  The bug in question was demonstrated in a discord comment https://discord.com/channels/753336465005608961/1239693193159639073/1239704153400414298 but I don't think we've opened an issue yet. Essentially, because of a mismatch between the outpoint and txout stored in TxGraph, we weren't summing the inputs correctly which caused `calculate_fee` to fail with `NegativeFee` error.

  fixes #1419

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

  #### Bugfixes:

  * [ ] I've added tests to reproduce the issue which are now passing

ACKs for top commit:
  LagginTimes:
    ACK af15ebba94f6d96a4d266fbbdee7c49150f80b96
  evanlinjin:
    ACK af15ebba94f6d96a4d266fbbdee7c49150f80b96

Tree-SHA512: c3a2c374069b0863076784856d90c7760b8f411e4881c3e42367015542b02ea6010c37745fb6dde95422af7222b7939ec51bc0fd1f63f816813c2159a17e08e5

19 months agofix(electrum): Fix `fetch_prev_txout`
valued mammal [Tue, 14 May 2024 14:43:19 +0000 (10:43 -0400)]
fix(electrum): Fix `fetch_prev_txout`

Previously we inserted every TxOut of a previous tx
at the same outpoint, which is incorrect because an outpoint
only points to a single TxOut. Now just get the TxOut
corresponding to the txin prevout and insert it with
its outpoint.

19 months agofix(export): add tr descriptor
rustaceanrob [Wed, 27 Mar 2024 21:02:50 +0000 (11:02 -1000)]
fix(export): add tr descriptor

19 months agoMerge bitcoindevkit/bdk#1326: chore: rename bdk crate to bdk_wallet
Steve Myers [Mon, 13 May 2024 17:17:46 +0000 (12:17 -0500)]
Merge bitcoindevkit/bdk#1326: chore: rename bdk crate to bdk_wallet

f6781652b7a4833b220e0853cd6e290bb5fc0136 chore: rename bdk crate to bdk_wallet (Steve Myers)

Pull request description:

  ### Description

  Fixes #1305 .

  ### Notes to the reviewers

  Once this properly builds, even before all reviews is done, I will publish it to crates.io to reserve the name.

  ### Changelog notice

  Changed

  - Renamed `bdk` crate to `bdk_wallet`.

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

Top commit has no ACKs.

Tree-SHA512: 437c79d9d41721bc9cffd3be81e898068378803dcde6b4106d33bf34ffa756d090dce36d15d4ecd232e5b55ce09c393e6956fc0af4b8477886dabb506b679256

19 months agochore: rename bdk crate to bdk_wallet
Steve Myers [Tue, 6 Feb 2024 14:56:31 +0000 (08:56 -0600)]
chore: rename bdk crate to bdk_wallet

19 months agoMerge bitcoindevkit/bdk#1437: Bump bdk version to 1.0.0-alpha.11 v1.0.0-alpha.11
Steve Myers [Fri, 10 May 2024 22:16:37 +0000 (17:16 -0500)]
Merge bitcoindevkit/bdk#1437: Bump bdk version to 1.0.0-alpha.11

db9fdccc18c418cbbdf39ef4e912416796d63860 Bump bdk version to 1.0.0-alpha.11 (Steve Myers)

Pull request description:

  ### Description

  fixes #1435

  bdk_chain to 0.14.0
  bdk_bitcoind_rpc to 0.10.0
  bdk_electrum to 0.13.0
  bdk_esplora to 0.13.0
  bdk_file_store to 0.11.0
  bdk_testenv to 0.4.0
  bdk_persist to 0.2.0

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

ACKs for top commit:
  ValuedMammal:
    ACK db9fdccc18c418cbbdf39ef4e912416796d63860
  storopoli:
    ACK db9fdccc18c418cbbdf39ef4e912416796d63860

Tree-SHA512: 804475927461a4bcf37786313123a0a0cc68390af6c556111551dc126a06614296eb657a8a5662a36cf4569ab332f5f9285c99c5f1992d93f43568e881961895

19 months agoBump bdk version to 1.0.0-alpha.11
Steve Myers [Fri, 10 May 2024 00:15:33 +0000 (19:15 -0500)]
Bump bdk version to 1.0.0-alpha.11

bdk_chain to 0.14.0
bdk_bitcoind_rpc to 0.10.0
bdk_electrum to 0.13.0
bdk_esplora to 0.13.0
bdk_file_store to 0.11.0
bdk_testenv to 0.4.0
bdk_persist to 0.2.0

19 months agoMerge bitcoindevkit/bdk#1403: Update `bdk_electrum` crate to use sync/full-scan structs
Steve Myers [Fri, 10 May 2024 17:22:13 +0000 (12:22 -0500)]
Merge bitcoindevkit/bdk#1403: Update `bdk_electrum` crate to use sync/full-scan structs

b45897e6fe2f7e67f5d75ec6f983757b28c5ec19 feat(electrum): update docs and simplify logic of `ElectrumExt` (志宇)
92fb6cb37387fb0b9fe5329e772f0d928a33e116 chore(electrum): do not use `anyhow::Result` directly (志宇)
b2f3cacce6081f3bf6e103d1d2ca0707c545a67e feat(electrum): include option for previous `TxOut`s for fee calculation (Wei Chen)
c0d7d60a582b939324bb48ec8c5035020ec90699 feat(chain)!: use custom return types for `ElectrumExt` methods (志宇)
2945c6be88b3bf5105afeb8addff4861f0458b41 fix(electrum): fixed `sync` functionality (Wei Chen)
9ed33c25ea01278b0a47c8ecd5ea6fa33119a977 docs(electrum): fixed `full_scan`, `sync`, and crate documentation (Wei Chen)
b1f861b932afd5e490c0814b1921b97cc2f1d912 feat: update logging of electrum examples (志宇)
a6fdfb2ae4caa1cdd23aa5e5ffaf02716473a98e feat(electrum)!: use new sync/full-scan structs for `ElectrumExt` (志宇)
653e4fed6d16698bc5859c1e4afdcee7b3d83dad feat(wallet): cache txs when constructing full-scan/sync requests (志宇)
58f27b38eb2093bb9b715b7e0ebd1619ecad74ee feat(chain): introduce `TxCache` to `SyncRequest` and `FullScanRequest` (志宇)
721bb7f519131ca295a00efa2d242b4923e2bddd fix(chain): Make `Anchor` type in `FullScanResult` generic (志宇)
e3cfb84898cfa79d4903cf276fc69ffb0605b4d4 feat(chain): `TxGraph::insert_tx` reuses `Arc` (志宇)
2ffb65618afb7382232a3c08a077dd1109005071 refactor(electrum): remove `RelevantTxids` and track txs in `TxGraph` (Wei Chen)

Pull request description:

  Fixes #1265
  Possibly fixes #1419

  ### Context

  Previous changes such as

  * Universal structures for full-scan/sync (PR #1413)
  * Making `CheckPoint` linked list query-able (PR #1369)
  * Making `Transaction`s cheaply-clonable (PR #1373)

  has allowed us to simplify the interaction between chain-source and receiving-structures (`bdk_chain`).

  The motivation is to accomplish something like this ([as mentioned here](https://github.com/bitcoindevkit/bdk/issues/1153#issuecomment-1752263555)):
  ```rust
  let things_I_am_interested_in = wallet.lock().unwrap().start_sync();
  let update = electrum_or_esplora.sync(things_i_am_interested_in)?;
  wallet.lock().unwrap().apply_update(update)?:
  ```

  ### Description

  This PR greatly simplifies the API of our Electrum chain-source (`bdk_electrum`) by making use of the aforementioned changes. Instead of referring back to the receiving `TxGraph` mid-sync/scan to determine which full transaction to fetch, we provide the Electrum chain-source already-fetched full transactions to start sync/scan (this is cheap, as transactions are wrapped in `Arc`s since #1373).

  In addition, an option has been added to include the previous `TxOut` for transactions received from an external wallet for fee calculation.

  ### Changelog notice

  * Change `TxGraph::insert_tx` to take in anything that satisfies `Into<Arc<Transaction>>`. This allows us to reuse the `Arc` pointer of what is being inserted.
  * Add `tx_cache` field to `SyncRequest` and `FullScanRequest`.
  * Make `Anchor` type in `FullScanResult` generic for more flexibility.
  * Change `ElectrumExt` methods to take in `SyncRequest`/`FullScanRequest` and return `SyncResult`/`FullScanResult`. Also update electrum examples accordingly.
  * Add `ElectrumResultExt` trait which allows us to convert the update `TxGraph` of `SyncResult`/`FullScanResult` for `bdk_electrum`.
  * Added an option for `full_scan` and `sync` to also fetch previous `TxOut`s to allow for fee calculation.

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

  #### New Features:

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

ACKs for top commit:
  ValuedMammal:
    ACK b45897e6fe2f7e67f5d75ec6f983757b28c5ec19
  notmandatory:
    ACK b45897e6fe2f7e67f5d75ec6f983757b28c5ec19

Tree-SHA512: 1e274546015e7c7257965b36079ffe0cb3c2c0b7c2e0c322bcf32a06925a0c3e1119da1c8fd5318f1dbd82c2e952f6a07f227a9b023c48f506a62c93045d96d3

19 months agofeat(electrum): update docs and simplify logic of `ElectrumExt`
志宇 [Fri, 10 May 2024 08:40:55 +0000 (16:40 +0800)]
feat(electrum): update docs and simplify logic of `ElectrumExt`

Helper method docs are updated to explain what they are updating. Logic
is simplified as we do not need to check whether a tx exists already in
`update_graph` before inserting it.

19 months agochore(electrum): do not use `anyhow::Result` directly
志宇 [Thu, 9 May 2024 08:38:56 +0000 (16:38 +0800)]
chore(electrum): do not use `anyhow::Result` directly

19 months agofeat(electrum): include option for previous `TxOut`s for fee calculation
Wei Chen [Tue, 7 May 2024 11:57:11 +0000 (19:57 +0800)]
feat(electrum): include option for previous `TxOut`s for fee calculation

The previous `TxOut` for transactions received from an external
wallet may be optionally added as floating `TxOut`s to `TxGraph`
to allow for fee calculation.

19 months agofeat(chain)!: use custom return types for `ElectrumExt` methods
志宇 [Tue, 7 May 2024 04:43:02 +0000 (12:43 +0800)]
feat(chain)!: use custom return types for `ElectrumExt` methods

This is more code, but a much more elegant solution than having
`ElectrumExt` methods return `SyncResult`/`FullScanResult` and having an
`ElectrumResultExt` extention trait.

19 months agofix(electrum): fixed `sync` functionality
Wei Chen [Mon, 6 May 2024 07:52:57 +0000 (15:52 +0800)]
fix(electrum): fixed `sync` functionality

19 months agodocs(electrum): fixed `full_scan`, `sync`, and crate documentation
Wei Chen [Mon, 6 May 2024 07:46:49 +0000 (15:46 +0800)]
docs(electrum): fixed `full_scan`, `sync`, and crate documentation

19 months agofeat: update logging of electrum examples
志宇 [Sat, 4 May 2024 11:27:11 +0000 (19:27 +0800)]
feat: update logging of electrum examples

* Syncing with `example_electrum` now shows progress as a percentage.
* Flush stdout more aggressively.

19 months agofeat(electrum)!: use new sync/full-scan structs for `ElectrumExt`
志宇 [Tue, 30 Apr 2024 06:50:21 +0000 (14:50 +0800)]
feat(electrum)!: use new sync/full-scan structs for `ElectrumExt`

`ElectrumResultExt` trait is also introduced that adds methods which can
convert the `Anchor` type for the update `TxGraph`.

We also make use of the new `TxCache` fields in
`SyncRequest`/`FullScanRequest`. This way, we can avoid re-fetching full
transactions from Electrum if not needed.

Examples and tests are updated to use the new `ElectrumExt` API.

19 months agofeat(wallet): cache txs when constructing full-scan/sync requests
志宇 [Wed, 1 May 2024 08:27:36 +0000 (16:27 +0800)]
feat(wallet): cache txs when constructing full-scan/sync requests

19 months agofeat(chain): introduce `TxCache` to `SyncRequest` and `FullScanRequest`
志宇 [Wed, 1 May 2024 08:24:21 +0000 (16:24 +0800)]
feat(chain): introduce `TxCache` to `SyncRequest` and `FullScanRequest`

This transaction cache can be provided so the chain-source can avoid
re-fetching transactions.

19 months agofix(chain): Make `Anchor` type in `FullScanResult` generic
志宇 [Wed, 1 May 2024 13:34:09 +0000 (21:34 +0800)]
fix(chain): Make `Anchor` type in `FullScanResult` generic

19 months agofeat(chain): `TxGraph::insert_tx` reuses `Arc`
志宇 [Tue, 30 Apr 2024 06:49:03 +0000 (14:49 +0800)]
feat(chain): `TxGraph::insert_tx` reuses `Arc`

When we insert a transaction that is already wrapped in `Arc`, we should
reuse the `Arc`.

19 months agorefactor(electrum): remove `RelevantTxids` and track txs in `TxGraph`
Wei Chen [Thu, 11 Apr 2024 21:57:14 +0000 (17:57 -0400)]
refactor(electrum): remove `RelevantTxids` and track txs in `TxGraph`

This PR removes `RelevantTxids` from the electrum crate and tracks
transactions in a `TxGraph`. This removes the need to separately
construct a `TxGraph` after a `full_scan` or `sync`.

19 months agoMerge bitcoindevkit/bdk#1203: Include the descriptor in `keychain::Changeset`
Steve Myers [Thu, 9 May 2024 18:12:07 +0000 (13:12 -0500)]
Merge bitcoindevkit/bdk#1203: Include the descriptor in `keychain::Changeset`

86711d4f46f467c651238ad3804fdbe1d22a8600 doc(chain): add section for non-recommended K to descriptor assignments (Daniela Brozzoni)
de53d721913537f56281a134270eafd356f908ad test: Only the highest ord keychain is returned (Daniela Brozzoni)
9d8023bf56a693f1cb2ba340ed024c654307c069 fix(chain): introduce keychain-variant-ranking to `KeychainTxOutIndex` (志宇)
6c8748124fd40e0fee37f78ca30457441b13fbcb chore(chain): move `use` in `indexed_tx_graph.rs` so clippy is happy (志宇)
537aa03ae0f8bec4dc799d33738e9bb7977bdac1 chore(chain): update test so clippy does not complain (志宇)
ed117de7a5b1756482b2e6487855b80e97c597ba test(chain): applying changesets one-by-one vs aggregate should be same (志宇)
6a3fb849e86e0bc21086519ae0201b95ddde5bf4 fix(chain): simplify `Append::append` impl for `keychain::ChangeSet` (志宇)
1d294b734dd6f4639075cba271e2b40f437f998f fix: Run tests only if the miniscript feature is.. ..enabled, enable it by default (Daniela Brozzoni)
0e3e136f6fa7215f6391dbcc1c4781262111ce64 doc(bdk): Add instructions for manually inserting... ...secret keys in the wallet in Wallet::load (Daniela Brozzoni)
76afccc555feff084867d6f9406e4e74bee938cc fix(wallet): add expected descriptors as signers after creating from wallet::ChangeSet (Steve Myers)
4f05441a00b921efd661da0dff94d9c28e38b70d keychain::ChangeSet includes the descriptor (Daniela Brozzoni)
8ff99f27dfe45643bf401409ca72429a9b812873 ref(chain): Define test descriptors, use them... ...everywhere (Daniela Brozzoni)
b9902936a0d17498eec8866233d89b2882d0af8f ref(chain): move `keychain::ChangeSet` into `txout_index.rs` (志宇)

Pull request description:

  Fixes #1101

  - Moves keychain::ChangeSet inside `keychain/txout_index.rs` as now the `ChangeSet` depends on miniscript
  - Slightly cleans up tests by introducing some constant descriptors
  - The KeychainTxOutIndex's internal SpkIterator now uses DescriptorId
  instead of K. The DescriptorId -> K translation is made at the
  KeychainTxOutIndex level.
  - The keychain::Changeset is now a struct, which includes a map for last
  revealed indexes, and one for newly added keychains and their
  descriptor.

  ### Changelog notice

  API changes in bdk:
  - Wallet::keychains returns a `impl Iterator` instead of `BTreeMap`
  - Wallet::load doesn't take descriptors anymore, since they're stored in the db
  - Wallet::new_or_load checks if the loaded descriptor from db is the same as the provided one

  API changes in bdk_chain:
  - `ChangeSet` is now a struct, which includes a map for last revealed
        indexes, and one for keychains and descriptors.
  - `KeychainTxOutIndex::inner` returns a `SpkIterator<(DescriptorId, u32)>`
  - `KeychainTxOutIndex::outpoints` returns a `BTreeSet` instead of `&BTreeSet`
  - `KeychainTxOutIndex::keychains` returns a `impl Iterator` instead of
        `&BTreeMap`
  - `KeychainTxOutIndex::txouts` doesn't return a ExactSizeIterator anymore
  - `KeychainTxOutIndex::last_revealed_indices` returns a `BTreeMap`
        instead of `&BTreeMap`
  - `KeychainTxOutIndex::add_keychain` has been renamed to `KeychainTxOutIndex::insert_descriptor`, and now it returns a ChangeSet
  - `KeychainTxOutIndex::reveal_next_spk` returns Option
  - `KeychainTxOutIndex::next_unused_spk` returns Option
  - `KeychainTxOutIndex::unbounded_spk_iter` returns Option
  - `KeychainTxOutIndex::next_index` returns Option
  - `KeychainTxOutIndex::reveal_to_target` returns Option
  - `KeychainTxOutIndex::revealed_keychain_spks` returns Option
  - `KeychainTxOutIndex::unused_keychain_spks` returns Option
  - `KeychainTxOutIndex::last_revealed_index` returns Option
  - `KeychainTxOutIndex::keychain_outpoints` returns Option
  - `KeychainTxOutIndex::keychain_outpoints_in_range` returns Option
  - `KeychainTxOutIndex::last_used_index` returns None if the keychain has never been used, or if it doesn't exist

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

Tree-SHA512: 4b1c9a31951f67b18037b7dd9837acbc35823f21de644ab833754b74d20f5373549f81e66965ecd3953ebf4f99644c9fd834812acfa65f9188950f1bda17ab60

19 months agodoc(chain): add section for non-recommended K to descriptor assignments
Daniela Brozzoni [Wed, 8 May 2024 13:45:45 +0000 (15:45 +0200)]
doc(chain): add section for non-recommended K to descriptor assignments

19 months agoMerge bitcoindevkit/bdk#1430: ci: Pin clippy to rust 1.78.0
Steve Myers [Thu, 9 May 2024 00:26:12 +0000 (19:26 -0500)]
Merge bitcoindevkit/bdk#1430: ci: Pin clippy to rust 1.78.0

de2763a4b88e65b1c67a06148b4f9e012e561c5a ci: Pin clippy to rust 1.78.0 (valued mammal)

Pull request description:

  This PR pins clippy check in CI to the rust 1.78 toolchain, which prevents new lints in stable releases from interrupting the usual workflow. Because rust versions are released on a predictable schedule, we can revisit this setting in the future as needed (say 3-6 months).

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

ACKs for top commit:
  danielabrozzoni:
    ACK de2763a4b88e65b1c67a06148b4f9e012e561c5a
  storopoli:
    ACK de2763a4b88e65b1c67a06148b4f9e012e561c5a
  notmandatory:
    ACK de2763a4b88e65b1c67a06148b4f9e012e561c5a
  oleonardolima:
    ACK de2763a4b88e65b1c67a06148b4f9e012e561c5a

Tree-SHA512: 73cad29a5ff437290aca8f85a011c4f5fc4d9ff5755f3d3ef9fa1820f5631eda857b1a67955adfc6ef98145958c674cc09f7613b96f38cc30c75a656d872edbc

19 months agotest: Only the highest ord keychain is returned
Daniela Brozzoni [Wed, 8 May 2024 13:33:06 +0000 (15:33 +0200)]
test: Only the highest ord keychain is returned

19 months agofix(chain): introduce keychain-variant-ranking to `KeychainTxOutIndex`
志宇 [Mon, 6 May 2024 11:21:13 +0000 (19:21 +0800)]
fix(chain): introduce keychain-variant-ranking to `KeychainTxOutIndex`

This fixes the bug with changesets not being monotone. Previously, the
result of applying changesets individually v.s. applying the aggregate
of changesets may result in different `KeychainTxOutIndex` states.

The nature of the changeset allows different keychain types to share the
same descriptor. However, the previous design did not take this into
account. To do this properly, we should keep track of all keychains
currently associated with a given descriptor. However, the API only
allows returning one keychain per spk/txout/outpoint (which is a good
API).

Therefore, we rank keychain variants by `Ord`. Earlier keychain variants
have a higher rank, and the first keychain will be returned.

19 months agochore(chain): move `use` in `indexed_tx_graph.rs` so clippy is happy
志宇 [Mon, 6 May 2024 10:04:34 +0000 (18:04 +0800)]
chore(chain): move `use` in `indexed_tx_graph.rs` so clippy is happy

19 months agochore(chain): update test so clippy does not complain
志宇 [Mon, 6 May 2024 09:52:11 +0000 (17:52 +0800)]
chore(chain): update test so clippy does not complain

19 months agotest(chain): applying changesets one-by-one vs aggregate should be same
志宇 [Sun, 5 May 2024 06:00:49 +0000 (14:00 +0800)]
test(chain): applying changesets one-by-one vs aggregate should be same

19 months agofix(chain): simplify `Append::append` impl for `keychain::ChangeSet`
志宇 [Sat, 4 May 2024 15:37:42 +0000 (23:37 +0800)]
fix(chain): simplify `Append::append` impl for `keychain::ChangeSet`

We only need to loop though entries of `other`. The logic before was
wasteful because we were also looping though all entries of `self` even
if we do not need to modify the `self` entry.

19 months agofix: Run tests only if the miniscript feature is..
Daniela Brozzoni [Wed, 8 May 2024 12:36:52 +0000 (14:36 +0200)]
fix: Run tests only if the miniscript feature is..
..enabled, enable it by default

19 months agodoc(bdk): Add instructions for manually inserting...
Daniela Brozzoni [Thu, 25 Apr 2024 18:13:22 +0000 (20:13 +0200)]
doc(bdk): Add instructions for manually inserting...
...secret keys in the wallet in Wallet::load

19 months agofix(wallet): add expected descriptors as signers after creating from wallet::ChangeSet
Steve Myers [Tue, 16 Apr 2024 03:13:07 +0000 (22:13 -0500)]
fix(wallet): add expected descriptors as signers after creating from wallet::ChangeSet

19 months agokeychain::ChangeSet includes the descriptor
Daniela Brozzoni [Mon, 15 Jan 2024 17:52:03 +0000 (18:52 +0100)]
keychain::ChangeSet includes the descriptor

- The KeychainTxOutIndex's internal SpkIterator now uses DescriptorId
  instead of K. The DescriptorId -> K translation is made at the
  KeychainTxOutIndex level.
- The keychain::Changeset is now a struct, which includes a map for last
  revealed indexes, and one for newly added keychains and their
  descriptor.

API changes in bdk:
- Wallet::keychains returns a `impl Iterator` instead of `BTreeMap`
- Wallet::load doesn't take descriptors anymore, since they're stored in
  the db
- Wallet::new_or_load checks if the loaded descriptor from db is the
  same as the provided one

API changes in bdk_chain:
- `ChangeSet` is now a struct, which includes a map for last revealed
  indexes, and one for keychains and descriptors.
- `KeychainTxOutIndex::inner` returns a `SpkIterator<(DescriptorId, u32)>`
- `KeychainTxOutIndex::outpoints` returns a `impl Iterator` instead of `&BTreeSet`
- `KeychainTxOutIndex::keychains` returns a `impl Iterator` instead of
  `&BTreeMap`
- `KeychainTxOutIndex::txouts` doesn't return a ExactSizeIterator
  anymore
- `KeychainTxOutIndex::unbounded_spk_iter` returns an `Option`
- `KeychainTxOutIndex::next_index` returns an `Option`
- `KeychainTxOutIndex::last_revealed_indices` returns a `BTreeMap`
  instead of `&BTreeMap`
- `KeychainTxOutIndex::reveal_to_target` returns an `Option`
- `KeychainTxOutIndex::reveal_next_spk` returns an `Option`
- `KeychainTxOutIndex::next_unused_spk` returns an `Option`
- `KeychainTxOutIndex::add_keychain` has been renamed to
  `KeychainTxOutIndex::insert_descriptor`, and now it returns a
  ChangeSet

19 months agoref(chain): Define test descriptors, use them...
Daniela Brozzoni [Fri, 10 Nov 2023 15:47:58 +0000 (16:47 +0100)]
ref(chain): Define test descriptors, use them...
...everywhere

19 months agoref(chain): move `keychain::ChangeSet` into `txout_index.rs`
志宇 [Wed, 11 Oct 2023 16:03:18 +0000 (00:03 +0800)]
ref(chain): move `keychain::ChangeSet` into `txout_index.rs`

We plan to record `Descriptor` additions into persistence. Hence, we
need to add `Descriptor`s to the changeset. This depends on
`miniscript`. Moving this into `txout_index.rs` makes sense as this is
consistent with all the other files. The only reason why this wasn't
this way before, is because the changeset didn't need miniscript.

Co-Authored-By: Daniela Brozzoni <danielabrozzoni@protonmail.com>
19 months agoMerge bitcoindevkit/bdk#1423: fix(persist): add default feature to enable bdk_chain/std
Steve Myers [Wed, 8 May 2024 00:24:27 +0000 (19:24 -0500)]
Merge bitcoindevkit/bdk#1423: fix(persist): add default feature to enable bdk_chain/std

a577c22b12f4edf0b2f2f266fb13656caf1d21c4 fix(persist): add default feature to enable bdk_chain/std (Steve Myers)

Pull request description:

  ### Description

  This PR adds a `default` feature to `bdk_persist` so it can be build on its own.  Once #1422 is done we can remove the `default`again.

  ### Notes to the reviewers

  I need to be able to build `bdk_persist` on its own so I can publish it to crates.io.

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

ACKs for top commit:
  ValuedMammal:
    ACK a577c22b12f4edf0b2f2f266fb13656caf1d21c4
  oleonardolima:
    ACK a577c22b12f4edf0b2f2f266fb13656caf1d21c4
  storopoli:
    ACK a577c22b12f4edf0b2f2f266fb13656caf1d21c4

Tree-SHA512: 8b07a9e4974dec8812ca19ce7226dcaece064270a0be8b83d3c326fdf1e89b051eb0bd8aa0eda9362b2c8233ecd6003b70c92ee046603973d8d40611418c3841

19 months agoci: Pin clippy to rust 1.78.0
valued mammal [Thu, 2 May 2024 21:21:34 +0000 (17:21 -0400)]
ci: Pin clippy to rust 1.78.0

19 months agoMerge bitcoindevkit/bdk#1411: feat: update `keychain::Balance` to use `bitcoin::Amount`
志宇 [Mon, 6 May 2024 12:22:57 +0000 (20:22 +0800)]
Merge bitcoindevkit/bdk#1411: feat: update `keychain::Balance` to use `bitcoin::Amount`

22aa534d7648e5808414ea3adfcfb702572bd6c9 feat: use `Amount` on `TxBuilder::add_recipient` (Leonardo Lima)
d5c0e7200cba0c3b4d3e3fbea168cd07ee6c1d2c feat: use `Amount` on `spk_txout_index` and related (Leonardo Lima)
8a33d98db977a07e130ad57fa9c658a5c90d4a4b feat: update `wallet::Balance` to use `bitcoin::Amount` (Leonardo Lima)

Pull request description:

  fixes #823

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

  ### Description

  It's being used on `Balance`, and throughout the code, an `u64` represents the amount, which relies on the user to infer its sats, not millisats, or any other representation.

  It updates the usage of `u64` on `Balance`, and other APIs:
  - `TxParams::add_recipient`
  - `KeyChainTxOutIndex::sent_and_received`, `KeyChainTxOutIndex::net_value`
  -  `SpkTxOutIndex::sent_and_received`, `SpkTxOutIndex::net_value`

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

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

  It updates some of the APIs to expect the `bitcoin::Amount`, but it does not update internal usage of u64, such as `TxParams` still expects and uses `u64`, please see the PR comments for related discussion.

  ### Changelog notice

  <!-- Notice the release manager should include in the release tag message changelog -->
  <!-- See https://keepachangelog.com/en/1.0.0/ for examples -->

  - Changed the `keychain::Balance` struct fields to use `Amount` instead of `u64`.
  - Changed the `add_recipient` method on `TxBuilder` implementation to expect `bitcoin::Amount`.
  - Changed the `sent_and_received`, and `net_value` methods on `KeyChainTxOutIndex` to expect `bitcoin::Amount`.
  - Changed the `sent_and_received`, and `net_value` methods on `SpkTxOutIndex` to expect `bitcoin::Amount`.

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

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

Tree-SHA512: c4e8198d96c0d66cc3d2e4149e8a56bb7565b9cd49ff42113eaebd24b1d7bfeecd7124db0b06524b78b8891ee1bde1546705b80afad408f48495cf3c02446d02

19 months agoMerge bitcoindevkit/bdk#1414: chore: clean up `electrsd` and `anyhow` dev dependencies
志宇 [Mon, 6 May 2024 12:12:07 +0000 (20:12 +0800)]
Merge bitcoindevkit/bdk#1414: chore: clean up `electrsd` and `anyhow` dev dependencies

f6218e4741a4b036d33a9f075ce5feb484e9bd87 chore: reexport crates in `TestEnv` (Wei Chen)
125959976f63a1e12fc139f048dc2856e993efe5 chore: remove `anyhow` dev dependency from `electrum`, `esplora`, and `bitcoind_rpc` (Wei Chen)

Pull request description:

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

  ### Description

  Reexports `electrsd` in `TestEnv` to remove the `electrsd` dev depedency out of `bdk_electrum` and `bdk_esplora`.
  Credit to @ValuedMammal for the idea.

  Since `bitcoind` reexports `anyhow`, this dev dependency was also removed from `bdk_electrum`, `bdk_esplora`, and `bdk_bitcoind_rpc`. `bitcoind`, `bitcoincore_rpc` and `electrum_client` were also reexported for convenience.

  ### Changelog notice

  * Change `bdk_testenv` to re-export internally used 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 f6218e4741a4b036d33a9f075ce5feb484e9bd87

Tree-SHA512: c7645eb91d08d4ccb80982a992f691b5a8c0df39df506f6b361bc6f2bb076d62cbe5bb5d88b4c684c36e22464c0674f21f6ef4e23733f89b03aa12ec43a67cba

19 months agoMerge bitcoindevkit/bdk#1427: docs(esplora): fixed `full_scan` and `sync` documentation
志宇 [Mon, 6 May 2024 12:09:12 +0000 (20:09 +0800)]
Merge bitcoindevkit/bdk#1427: docs(esplora): fixed `full_scan` and `sync` documentation

f6dc6890c37752e80c86c68ae3ca3cc4fac6245e docs(esplora): fixed `full_scan` and `sync` documentation (Wei Chen)

Pull request description:

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

  ### Description

  Fixed documentation for `full_scan` and `sync` in `bdk_esplora`.

  ### Changelog notice

  <!-- Notice the release manager should include in the release tag message changelog -->
  <!-- See https://keepachangelog.com/en/1.0.0/ for examples -->
  * Updated documentation for `full_scan` and `sync` in `bdk_esplora`.

  ### 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 f6dc6890c37752e80c86c68ae3ca3cc4fac6245e
  storopoli:
    ACK f6dc6890c37752e80c86c68ae3ca3cc4fac6245e

Tree-SHA512: 900fb1a2839379af867a6effad32ec4bdfb897330a72ee1e1ec203299e7f3d5fae576550aeed8fd93c5c70a13ad2b0e898033d8b45b490319b5d74216b93f332

19 months agodocs(esplora): fixed `full_scan` and `sync` documentation
Wei Chen [Mon, 6 May 2024 08:51:19 +0000 (16:51 +0800)]
docs(esplora): fixed `full_scan` and `sync` documentation

19 months agofeat: use `Amount` on `TxBuilder::add_recipient`
Leonardo Lima [Fri, 26 Apr 2024 14:41:17 +0000 (11:41 -0300)]
feat: use `Amount` on `TxBuilder::add_recipient`

19 months agofeat: use `Amount` on `spk_txout_index` and related
Leonardo Lima [Fri, 26 Apr 2024 14:17:23 +0000 (11:17 -0300)]
feat: use `Amount` on `spk_txout_index` and related

- update `wallet.rs` fns: `sent_and_received` fn
- update `keychain` `txout_index` fn: `sent_and_received and `net_value`

19 months agochore: reexport crates in `TestEnv`
Wei Chen [Fri, 3 May 2024 03:38:48 +0000 (11:38 +0800)]
chore: reexport crates in `TestEnv`

19 months agochore: remove `anyhow` dev dependency from `electrum`, `esplora`, and `bitcoind_rpc`
Wei Chen [Fri, 26 Apr 2024 07:28:41 +0000 (03:28 -0400)]
chore: remove `anyhow` dev dependency from `electrum`, `esplora`, and `bitcoind_rpc`

19 months agofeat: update `wallet::Balance` to use `bitcoin::Amount`
Leonardo Lima [Wed, 24 Apr 2024 21:12:45 +0000 (18:12 -0300)]
feat: update `wallet::Balance` to use `bitcoin::Amount`

- update all fields `immature`, ` trusted_pending`, `unstrusted_pending`
  and `confirmed` to use the `bitcoin::Amount` instead of `u64`
- update all `impl Balance` methods to use `bitcoin::Amount`
- update all tests that relies on `keychain::Balance`

19 months agoMerge bitcoindevkit/bdk#1417: test(wallet): add thread safety test
志宇 [Sat, 4 May 2024 12:24:12 +0000 (20:24 +0800)]
Merge bitcoindevkit/bdk#1417: test(wallet): add thread safety test

db4734747240d2e1cc72bbfd7be6c49baa8d2967 test(wallet): add thread safety test (Rob N)

Pull request description:

  ### Description

  `Wallet` auto-implements `Send` and `Sync` after removing the generic. This test is a compile time error if there are changes to `Wallet` in the future that make it unsafe to send between threads. See #1387 for discussion.

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

  #### New Features:

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

  #### Bugfixes:

  * [ ] This pull request breaks the existing API
  * [ ] I've added tests to reproduce the issue which are now passing
  * [ ] I'm linking the issue being fixed by this PR

ACKs for top commit:
  evanlinjin:
    ACK db4734747240d2e1cc72bbfd7be6c49baa8d2967

Tree-SHA512: 490e666bc503f15286268db7e5e2f75ee44ad2f80251d6f7a01af2a435023b87607eee33623712433ea8d27511be63c6c1e9cad4159b3fe66a4644cfa9e344fb

19 months agotest(wallet): add thread safety test
Rob N [Wed, 1 May 2024 08:53:09 +0000 (22:53 -1000)]
test(wallet): add thread safety test

19 months agofix(persist): add default feature to enable bdk_chain/std
Steve Myers [Thu, 2 May 2024 18:30:13 +0000 (13:30 -0500)]
fix(persist): add default feature to enable bdk_chain/std

19 months agoMerge bitcoindevkit/bdk#1420: Bump bdk version to 1.0.0-alpha.10 v1.0.0-alpha.10
Daniela Brozzoni [Thu, 2 May 2024 15:54:07 +0000 (17:54 +0200)]
Merge bitcoindevkit/bdk#1420: Bump bdk version to 1.0.0-alpha.10

2cda9f44ee1807898e4f2afffc95774839fee678 Bump bdk version to 1.0.0-alpha.10 (Daniela Brozzoni)

Pull request description:

  ### Description

  bdk_chain to 0.13.0
  bdk_bitcoind_rpc to 0.9.0
  bdk_electrum to 0.12.0
  bdk_esplora to 0.12.0
  bdk_file_store to 0.10.0
  bdk_testenv to 0.3.0
  bdk_persist to 0.2.0

  ### Checklists
  #### All Submissions:
  - [x] I've signed all my commits
  - [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  - [x] I ran cargo fmt and cargo clippy before committing

ACKs for top commit:
  storopoli:
    ACK 2cda9f44ee1807898e4f2afffc95774839fee678

Tree-SHA512: 7d3e5f2c9b9da13713e3bb1e6a11d07e9c381221c837a002aefb780698b1d45d64f2582bd0445ecdf7432bf3fe0ba5d6dadd43aa413cf4e5e557f7334a02fa06

19 months agoBump bdk version to 1.0.0-alpha.10
Daniela Brozzoni [Thu, 2 May 2024 12:38:56 +0000 (14:38 +0200)]
Bump bdk version to 1.0.0-alpha.10

bdk_chain to 0.13.0
bdk_bitcoind_rpc to 0.9.0
bdk_electrum to 0.12.0
bdk_esplora to 0.12.0
bdk_file_store to 0.10.0
bdk_testenv to 0.3.0
bdk_persist to 0.2.0

19 months agoMerge bitcoindevkit/bdk#1421: fix: Cargo clippy lints
Daniela Brozzoni [Thu, 2 May 2024 13:43:43 +0000 (15:43 +0200)]
Merge bitcoindevkit/bdk#1421: fix: Cargo clippy lints

a5fb7fdf505a53b5865ed83d53745e7efa5e7818 fix: Cargo clippy lints after rust 1.78 (Daniela Brozzoni)

Pull request description:

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

  ### Description

  Caught when trying to release (#1420), clippy failed randomly although it worked on master, this happened because rust 1.78 had just been release and we use clippy stable. IMHO we should pin the clippy version in CI and bump it manually at each new rust release.

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

Tree-SHA512: c803366367576224f9e9690cdee2c0161fc083550355415f9174e93ada2f597440f54ac966bb3ebecdc916824d43de17ac72801e4ef0f75c8a1df640fe40df6d

19 months agofix: Cargo clippy lints after rust 1.78
Daniela Brozzoni [Thu, 2 May 2024 12:53:37 +0000 (14:53 +0200)]
fix: Cargo clippy lints after rust 1.78

19 months agoMerge bitcoindevkit/bdk#1413: Introduce universal sync/full-scan structures for spk...
志宇 [Wed, 1 May 2024 06:58:41 +0000 (14:58 +0800)]
Merge bitcoindevkit/bdk#1413: Introduce universal sync/full-scan structures for spk-based syncing

c0374a0eeb155f1cb4f9d99223f6bc65d24f7df8 feat(chain): `SyncRequest` now uses `ExactSizeIterator`s (志宇)
0f94f24aaf6374fe2d7c2abf32a870d3849fb8cc feat(esplora)!: update to use new sync/full-scan structures (志宇)
4c52f3e08e85e73db379ee3411cceb8dbcec92e1 feat(wallet): make wallet compatible with sync/full-scan structures (志宇)
cdfec5f90726f2313963c3a71e5d18bb10624736 feat(chain): add sync/full-scan structures for spk-based syncing (志宇)

Pull request description:

  Fixes #1153
  Replaces #1194

  ### Description

  Introduce universal structures that represent sync/full-scan requests/results.

  ### Notes to the reviewers

  This is based on #1194 but is different in the following ways:
  * The functionality to print scan/sync progress is not reduced.
  * `SyncRequest` and `FullScanRequest` is simplified and fields are exposed for more flexibility.

  ### Changelog notice

  * Add universal structures for initiating/receiving sync/full-scan requests/results for spk-based syncing.
  * Updated `bdk_esplora` chain-source to make use of new universal sync/full-scan structures.

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

Tree-SHA512: c2ad66d972a6785079bca615dfd128edcedf6b7a02670651a0ab1ce5b5174dd96f54644680eedbf55e3f1955fe5c34f632eadbd3f71d7ffde658753c6c6d42be

19 months agoMerge bitcoindevkit/bdk#1412: Add new crate `bdk-persist`
志宇 [Mon, 29 Apr 2024 08:37:47 +0000 (16:37 +0800)]
Merge bitcoindevkit/bdk#1412: Add new crate `bdk-persist`

81de8f60516899fad2ec99cbd15d6b8d02385ebb feat(bdk-persist): extract persistence traits to new crate (Rob N)

Pull request description:

  ### Description

  #1387 introduced `anyhow` as a dependency to remove generics from `Wallet`. Introducing a new crate for persistence types removes the dependency on `anyhow` for `bdk_chain`. Resolves #1409, as well as removing the old documentation for "tracker".

  ### Notes to the reviewers

  Open for any comments.

  ### Changelog notice

  - Introduce `bdk-persist` crate

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

ACKs for top commit:
  evanlinjin:
    ACK 81de8f60516899fad2ec99cbd15d6b8d02385ebb

Tree-SHA512: 29b192b13f3951cc67c06bec7f788d8d7a4aeaf2ffcbf9476d4a6567529d284a93594c8d94b69741a68a9aadfdc9f6c4178084a2298c505e8e0d505219400382

19 months agofeat(chain): `SyncRequest` now uses `ExactSizeIterator`s
志宇 [Sat, 27 Apr 2024 12:40:08 +0000 (20:40 +0800)]
feat(chain): `SyncRequest` now uses `ExactSizeIterator`s

This allows the caller to track sync progress.

19 months agofeat(bdk-persist): extract persistence traits to new crate
Rob N [Thu, 25 Apr 2024 01:01:17 +0000 (15:01 -1000)]
feat(bdk-persist): extract persistence traits to new crate

19 months agofeat(esplora)!: update to use new sync/full-scan structures
志宇 [Thu, 25 Apr 2024 02:36:06 +0000 (10:36 +0800)]
feat(esplora)!: update to use new sync/full-scan structures

19 months agofeat(wallet): make wallet compatible with sync/full-scan structures
志宇 [Wed, 24 Apr 2024 08:54:03 +0000 (16:54 +0800)]
feat(wallet): make wallet compatible with sync/full-scan structures

* Changed `Wallet::apply_update` to also take in anything that
  implements `Into<Update>`. This allows us to directly apply a
  `FullScanResult` or `SyncResult`.
* Added `start_full_scan` and `start_sync_with_revealed_spks` methods to
  `Wallet`.

Co-authored-by: Steve Myers <steve@notmandatory.org>
19 months agofeat(chain): add sync/full-scan structures for spk-based syncing
志宇 [Wed, 24 Apr 2024 08:05:59 +0000 (16:05 +0800)]
feat(chain): add sync/full-scan structures for spk-based syncing

These structures allows spk-based chain-sources to have a universal API.

Co-authored-by: Steve Myers <steve@notmandatory.org>
19 months agoMerge bitcoindevkit/bdk#1380: Simplified `EsploraExt` API
志宇 [Mon, 22 Apr 2024 09:44:44 +0000 (17:44 +0800)]
Merge bitcoindevkit/bdk#1380: Simplified `EsploraExt` API

96a9aa6e63474dbd93a2ef969eef5b07c79e6491 feat(chain): refactor `merge_chains` (志宇)
2f22987c9e924800f8682b2dcbdde60fd26b069a chore(chain): fix comment (志宇)
daf588f016ec3118c875db8ed6b55fa03683f0f6 feat(chain): optimize `merge_chains` (志宇)
77d35954c1f3a18f767267e9097f63ca11c709ec feat(chain)!: rm `local_chain::Update` (志宇)
1269b0610efb7bd86d92a909800f9330568c797a test(chain): fix incorrect test case (志宇)
72fe65b65f297ebb7160eee6859c46e29c2d9528 feat(esplora)!: simplify chain update logic (志宇)
eded1a7ea0c6a4b9664826df4f77b714cbad0bcc feat(chain): introduce `CheckPoint::insert` (志宇)
519cd75d23fbb72321b0b189dca12afbfd78c0c7 test(esplora): move esplora tests into src files (志宇)
a6e613e6b978b995abf6c92a16df0300b113aa2c test(esplora): add `test_finalize_chain_update` (志宇)
494d253493f1bc914adba16a28ccf1bc0a0f4ec8 feat(testenv): add `genesis_hash` method (志宇)
886d72e3d541d088320bbdad6804057f32aca684 chore(chain)!: rm `missing_heights` and `missing_heights_from` methods (志宇)
bd62aa0fe199d676710c9909617198d62f4897c0 feat(esplora)!: remove `EsploraExt::update_local_chain` (志宇)
1e997939837e9c1f0c087d6d28ac12e373c8c05f feat(testenv): add `make_checkpoint_tip` (志宇)

Pull request description:

  Fixes #1354

  ### Description

  Built on top of both #1369 and #1373, we simplify the `EsploraExt` API by removing the `update_local_chain` method and having `full_scan` and `sync` update the local chain in the same call. The `full_scan` and `sync` methods now takes in an additional input (`local_tip`) which provides us with the view of the `LocalChain` before the update. These methods now return structs `FullScanUpdate` and `SyncUpdate`.

  The examples are updated to use this new API. `TxGraph::missing_heights` and `tx_graph::ChangeSet::missing_heights_from` are no longer needed, therefore they are removed.

  Additionally, we used this opportunity to simplify the logic which updates `LocalChain`. We got rid of the `local_chain::Update` struct (which contained the update `CheckPoint` tip and a `bool` which signaled whether we want to introduce blocks below point of agreement). It turns out we can use something like `CheckPoint::insert` so the chain source can craft an update based on the old tip. This way, we can make better use of `merge_chains`' optimization that compares the `Arc` pointers of the local and update chain (before we were crafting the update chain NOT based on top of the previous local chain). With this, we no longer need the `Update::introduce_older_block` field since the logic will naturally break when we reach a matching `Arc` pointer.

  ### Notes to the reviewers

  * Obtaining the `LocalChain`'s update now happens within `EsploraExt::full_scan` and `EsploraExt::sync`. Creating the `LocalChain` update is now split into two methods (`fetch_latest_blocks` and `chain_update`) that are called before and after fetching transactions and anchors.
  * We need to duplicate code for `bdk_esplora`. One for blocking and one for async.

  ### Changelog notice

  * Changed `EsploraExt` API so that sync only requires one round of fetching data. The `local_chain_update` method is removed and the `local_tip` parameter is added to the `full_scan` and `sync` methods.
  * Removed `TxGraph::missing_heights` and `tx_graph::ChangeSet::missing_heights_from` methods.
  * Introduced `CheckPoint::insert` which allows convenient checkpoint-insertion. This is intended for use by chain-sources when crafting an update.
  * Refactored `merge_chains` to also return the resultant `CheckPoint` tip.
  * Optimized the update `LocalChain` logic - use the update `CheckPoint` as the new `CheckPoint` tip when possible.

  ### 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:
  LLFourn:
    ACK 96a9aa6e63474dbd93a2ef969eef5b07c79e6491

Tree-SHA512: 3d4f2eab08a1fe94eb578c594126e99679f72e231680b2edd4bfb018ba1d998ca123b07acb2d19c644d5887fc36b8e42badba91cd09853df421ded04de45bf69

19 months agofeat(chain): refactor `merge_chains`
志宇 [Mon, 22 Apr 2024 03:59:18 +0000 (11:59 +0800)]
feat(chain): refactor `merge_chains`

`merge_chains` now returns a tuple of the resultant checkpoint AND
changeset. This is arguably a more readable/understandable setup.

To do this, we had to create `CheckPoint::apply_changeset` which is kept
as a private method.

Thank you @ValuedMammal for the suggestion.

Co-authored-by: valuedvalued mammal <valuedmammal@protonmail.com>
19 months agochore(chain): fix comment
志宇 [Mon, 22 Apr 2024 02:39:37 +0000 (10:39 +0800)]
chore(chain): fix comment

20 months agoMerge bitcoindevkit/bdk#1408: Fix: enable blocking-https-rustls feature on esplora...
志宇 [Sat, 20 Apr 2024 08:00:51 +0000 (16:00 +0800)]
Merge bitcoindevkit/bdk#1408: Fix: enable blocking-https-rustls feature on esplora client

d3a14d411d2a1a37f07e42c28eae3a1836aec14d fix: enable blocking-https-rustls feature on esplora client (thunderbiscuit)

Pull request description:

  The [`blocking` feature on the rust-esplora-client library](https://github.com/bitcoindevkit/rust-esplora-client/blame/master/Cargo.toml#L35) changed from ureq to minreq, which does not come with https enabled by default, breaking previously working code that simply enabled the `blocking` feature on the `bdk_esplora` crate.

  This change will enable what is currently the "default https" [flag for the minreq library](https://docs.rs/minreq/latest/minreq/#https-or-https-rustls) when using the `blocking` feature on bdk_esplora, reverting that breaking change.

  ### Notes to the reviewers

  Another way we could do this (let me know if this is preferable) is to add a new feature called `blocking-https-rustls`:
  ```rust
  blocking = ["esplora-client/blocking"]
  blocking-https-rustls = ["esplora-client/blocking-https-rustls"]
  ```

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

  * [x] I've added tests for the new feature
  * [x] 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:
  storopoli:
    ACK d3a14d411d2a1a37f07e42c28eae3a1836aec14d
  evanlinjin:
    ACK d3a14d411d2a1a37f07e42c28eae3a1836aec14d

Tree-SHA512: d25495186ceba2fcd04bc9ff0aebfb32ac5db6885ef8e4df1e304c5ee5264f6161821e06d29367d2837afcc64a53f1553e7c0bb065e6a2e46dc08b8e04c2ad8e

20 months agoMerge bitcoindevkit/bdk#1402: [wallet] Improve address API
志宇 [Sat, 20 Apr 2024 07:41:56 +0000 (15:41 +0800)]
Merge bitcoindevkit/bdk#1402: [wallet] Improve address API

d39b319ddf6bf3365d5d01841a8d366c6231db06 test(wallet): Test wallet addresses (valued mammal)
a266b4718f7839759a3e615805931041b67b8e91 chore(wallet)!: Remove enum AddressIndex (valued mammal)
d87874780b4a4c7be282381ae1102c028f3ae581 refactor(wallet)!: Remove method get_address (valued mammal)
d3763e5e37569cea0860217fba980ab0389e4e64 feat(wallet): Add new address methods (valued mammal)

Pull request description:

  Improvements to the wallet address API, see commit messages for details.

  ### Notes to the reviewers

  The logic of getting addresses is roughly the same as before when using `AddressIndex`, following this mapping:

  - `New` -> `reveal_next_address`
  - `LastUnused` -> `next_unused_address` (assuming this is what `LastUnused` really means)
  - `Peek` -> `peek_address`

  Wondering whether it makes sense to expose [`is_used`](https://github.com/bitcoindevkit/bdk/blob/358e842dcda0eb867d229881823c76dba1d7cce1/crates/chain/src/keychain/txout_index.rs#L236) for Wallet as well.

  fixes #898

  ### Changelog notice

  Added:

  - Added Wallet methods:
    - `peek_address`
    - `reveal_next_address`
    - `next_unused_address`
    - `reveal_addresses_to`
    - `list_unused_addresses`
    - `mark_used`
    - `unmark_used`

  Removed:

  - Removed Wallet methods:
    - `get_address`
    - `get_internal_address`
    - `try_get_address`
    - `try_get_internal_address`

  - Removed type AddressIndex

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

  ### Feature

  * [x] I've added tests for the new feature
  * [x] I've added docs for the new feature
  * [x] This pull request breaks the existing API
  * [x] I'm linking the issue being fixed by this PR

ACKs for top commit:
  evanlinjin:
    ACK d39b319ddf6bf3365d5d01841a8d366c6231db06

Tree-SHA512: ab7f3031f552ee6ea58ae4f3c5412bbedc0ea63e662fe9fa402de0f68a50448521be1e118e89f70bf970d5bf44ea1dc66bbeeff3e9312bae966bebd3072a7073

20 months agotest(wallet): Test wallet addresses
valued mammal [Sun, 14 Apr 2024 20:02:10 +0000 (16:02 -0400)]
test(wallet): Test wallet addresses

Adds test coverage for Wallet methods `reveal_addresses_to`,
`mark_used`, and `unmark_used`

20 months agochore(wallet)!: Remove enum AddressIndex
valued mammal [Sun, 14 Apr 2024 14:58:59 +0000 (10:58 -0400)]
chore(wallet)!: Remove enum AddressIndex

20 months agorefactor(wallet)!: Remove method get_address
valued mammal [Sun, 14 Apr 2024 14:57:48 +0000 (10:57 -0400)]
refactor(wallet)!: Remove method get_address

As this is now made redundant by the newly added
wallet address methods.

20 months agofeat(wallet): Add new address methods
valued mammal [Wed, 10 Apr 2024 19:16:40 +0000 (15:16 -0400)]
feat(wallet): Add new address methods

Introduce a new API for getting addresses from the Wallet that
reflects a similiar interface as the underlying indexer
`KeychainTxOutIndex` in preparation for removing `AddressIndex` enum.

Before this change, the only way to get an address was via the methods
`try_get{_internal}_address` which required a `&mut` reference to the
wallet, matching on the desired AddressIndex variant. This is too
restrictive since for example peeking or listing unused addresses
shouldn't change the state of the wallet. Hence we provide separate
methods for each use case which makes for a more efficient API.

20 months agoMerge bitcoindevkit/bdk#1387: fix(wallet): remove the generic from wallet
志宇 [Sat, 20 Apr 2024 06:51:26 +0000 (14:51 +0800)]
Merge bitcoindevkit/bdk#1387: fix(wallet): remove the generic from wallet

e51af49ffa951e14203ac2b465ade351dd90f6cd fix(wallet): remove generic from wallet (Rob N)

Pull request description:

  ### Description

  The `PersistenceBackend` uses generics to describe errors returned while applying the change set to the persistence layer. This change removes generics wherever possible and introduces a new public error enum. Removing the generics from `PersistenceBackend` errors is the first step towards #1363

  *Update*: I proceeded with removing the generics from `Wallet` by introducing a `Box<dyn PersistenceBackend>` .

  ### Notes to the reviewers

  This one sort of blew up in the number of changes due to the use of generics for most of the `Wallet` error variants. The generics were only used for the persistence errors, so I removed the generics from higher level errors whenever possible. The error variants of `PersistenceBackend` may also be more expressive, but I will level that up for discussion and make any changes required.

  ### Changelog notice

  - Changed `PersistenceBackend` errors to depend on the `anyhow` crate.
  - Remove the generic `T` from `Wallet`

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

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

Tree-SHA512: 8ce4f1c495310e16145555f4a6a29a0f42cf8944eda68004595c3532580767f64f779185022147a00d75001c40d69fdf8f8de2d348eb68484b170d2a181117ff

20 months agofix: enable blocking-https-rustls feature on esplora client
thunderbiscuit [Thu, 18 Apr 2024 19:07:48 +0000 (15:07 -0400)]
fix: enable blocking-https-rustls feature on esplora client

20 months agoMerge bitcoindevkit/bdk#1324: [chain] Make KeychainTxOutIndex more range based
志宇 [Thu, 18 Apr 2024 07:38:35 +0000 (15:38 +0800)]
Merge bitcoindevkit/bdk#1324: [chain] Make KeychainTxOutIndex more range based

fac228337c79e1a7c406500c177e049e7f9f5da7 feat(chain)!: make `KeychainTxOutIndex` more range based (LLFourn)

Pull request description:

  KeychainTxOut index should try and avoid "all" kind of queries. There may be subranges of interest. If the user wants "all" they can just query "..".

  The ideas is that KeychainTxOutIndex should be designed to be able to incorporate many unrelated keychains that can be managed in the same index. We should be able to see the "net_value" of a transaction to a specific subrange. e.g. imagine a collaborative custody service that manages all their user descriptors inside the same `KeychainTxOutIndex`. One user in their service may pay another so when you are analyzing how much a transaction is spending for a particular user you need to do analyze a particular sub-range.

  ### Notes to the reviewers

  - I didn't change `unused_spks` to follow this rule because I want to delete that method some time in the future. `unused_spks` is being used in the examples for syncing but it shouldn't be (the discussion as to why will probably surface in #1194).
  - I haven't applied this reasoning to the methods that return `BTreeMap`s e.g. `all_unbounded_spk_iters`. It probably should be but I haven't made up my mind yet.

  This probably belongs after #1194

  ### Changelog notice

  - `KeychainTxOutIndex` methods modified to take ranges of keychains 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

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

Tree-SHA512: ec1e75f19d79f71de4b6d7748ef6da076ca92c2f3fd07e0f0dc88e091bf80c61268880ef78be4bed5e0dbab2572e22028f868f33e68a67d47813195d38d78ba5

20 months agofeat(chain)!: make `KeychainTxOutIndex` more range based
LLFourn [Tue, 6 Feb 2024 06:31:22 +0000 (17:31 +1100)]
feat(chain)!: make `KeychainTxOutIndex` more range based

`KeychainTxOutIndex` should try and avoid "all" kind of queries.
There may be subranges of interest. If the user wants "all" they can
just query "..".

20 months agofeat(chain): optimize `merge_chains`
志宇 [Wed, 17 Apr 2024 06:06:44 +0000 (14:06 +0800)]
feat(chain): optimize `merge_chains`

20 months agofeat(chain)!: rm `local_chain::Update`
志宇 [Wed, 17 Apr 2024 02:02:12 +0000 (10:02 +0800)]
feat(chain)!: rm `local_chain::Update`

The intention is to remove the `Update::introduce_older_blocks`
parameter and update the local chain directly with `CheckPoint`.

This simplifies the API and there is a way to do this efficiently.

20 months agotest(chain): fix incorrect test case
志宇 [Wed, 17 Apr 2024 02:44:26 +0000 (10:44 +0800)]
test(chain): fix incorrect test case

20 months agofeat(esplora)!: simplify chain update logic
志宇 [Tue, 16 Apr 2024 09:30:58 +0000 (17:30 +0800)]
feat(esplora)!: simplify chain update logic

Co-authored-by: LLFourn <lloyd.fourn@gmail.com>
20 months agofeat(chain): introduce `CheckPoint::insert`
志宇 [Mon, 15 Apr 2024 06:37:11 +0000 (14:37 +0800)]
feat(chain): introduce `CheckPoint::insert`

Co-authored-by: LLFourn <lloyd.fourn@gmail.com>
20 months agotest(esplora): move esplora tests into src files
志宇 [Wed, 3 Apr 2024 06:29:02 +0000 (14:29 +0800)]
test(esplora): move esplora tests into src files

Since we want to keep these methods private.

20 months agotest(esplora): add `test_finalize_chain_update`
志宇 [Tue, 26 Mar 2024 12:29:20 +0000 (20:29 +0800)]
test(esplora): add `test_finalize_chain_update`

We ensure that calling `finalize_chain_update` does not result in a
chain which removed previous heights and all anchor heights are
included.

20 months agofeat(testenv): add `genesis_hash` method
志宇 [Tue, 26 Mar 2024 12:12:51 +0000 (20:12 +0800)]
feat(testenv): add `genesis_hash` method

This gets the genesis hash of the env blockchain.

20 months agochore(chain)!: rm `missing_heights` and `missing_heights_from` methods
志宇 [Tue, 26 Mar 2024 07:11:43 +0000 (15:11 +0800)]
chore(chain)!: rm `missing_heights` and `missing_heights_from` methods

These methods are no longer needed as we can determine missing heights
directly from the `CheckPoint` tip.

20 months agofeat(esplora)!: remove `EsploraExt::update_local_chain`
志宇 [Mon, 25 Mar 2024 05:39:21 +0000 (13:39 +0800)]
feat(esplora)!: remove `EsploraExt::update_local_chain`

Previously, we would update the `TxGraph` and `KeychainTxOutIndex`
first, then create a second update for `LocalChain`. This required
locking the receiving structures 3 times (instead of twice, which
is optimal).

This PR eliminates this requirement by making use of the new `query`
method of `CheckPoint`.

Examples are also updated to use the new API.

20 months agofeat(testenv): add `make_checkpoint_tip`
志宇 [Mon, 25 Mar 2024 05:44:01 +0000 (13:44 +0800)]
feat(testenv): add `make_checkpoint_tip`

This creates a checkpoint linked list which contains all blocks.

20 months agofix(wallet): remove generic from wallet
Rob N [Sat, 13 Apr 2024 20:21:24 +0000 (10:21 -1000)]
fix(wallet): remove generic from wallet

20 months agoMerge bitcoindevkit/bdk#1404: Bump bdk version to 1.0.0-alpha.9 v1.0.0-alpha.9
Steve Myers [Mon, 15 Apr 2024 20:05:29 +0000 (15:05 -0500)]
Merge bitcoindevkit/bdk#1404: Bump bdk version to 1.0.0-alpha.9

5f238d8e672047ac2766550aa3ed97e05e7b2531 Bump bdk version to 1.0.0-alpha.9 (Steve Myers)

Pull request description:

  ### Description

  Bump bdk version to 1.0.0-alpha.9

  bdk_chain to 0.12.0
  bdk_bitcoind_rpc to 0.8.0
  bdk_electrum to 0.11.0
  bdk_esplora to 0.11.0
  bdk_file_store to 0.9.0
  bdk_testenv to 0.2.0

  fixes #1399

  ### Notes to the reviewers

  I also removed unneeded version for bdk_testenv in dev-dependencies, see https://github.com/bitcoindevkit/bdk/pull/1177#discussion_r1545945973.

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

Tree-SHA512: 7ede94a6476a6b8c49a16b0aad147030eab23e26b9c4cadb1dd319fb8562ae325640f506f2d6dab0e85b0ee7f6955ac298ec1f70264704dc7f9a9492f8794f38

20 months agoBump bdk version to 1.0.0-alpha.9
Steve Myers [Fri, 12 Apr 2024 00:51:15 +0000 (19:51 -0500)]
Bump bdk version to 1.0.0-alpha.9

bdk_chain to 0.12.0
bdk_bitcoind_rpc to 0.8.0
bdk_electrum to 0.11.0
bdk_esplora to 0.11.0
bdk_file_store to 0.9.0
bdk_testenv to 0.2.0

20 months agoMerge bitcoindevkit/bdk#1177: Upgrade bitcoin/miniscript dependencies
Steve Myers [Fri, 12 Apr 2024 15:48:48 +0000 (10:48 -0500)]
Merge bitcoindevkit/bdk#1177: Upgrade bitcoin/miniscript dependencies

984c758f964f8fee687d21885b43b0b4705f318c Upgrade miniscript/bitcoin dependency (Tobin C. Harding)

Pull request description:

  Upgrade:

  - bitcoin to v0.31.0
  - miniscript to v11.0.0

  Fix: #1196

ACKs for top commit:
  ValuedMammal:
    ACK 984c758f964f8fee687d21885b43b0b4705f318c
  notmandatory:
    ACK 984c758f964f8fee687d21885b43b0b4705f318c
  oleonardolima:
    ACK 984c758f964f8fee687d21885b43b0b4705f318c
  storopoli:
    ACK 984c758f964f8fee687d21885b43b0b4705f318c

Tree-SHA512: d64d530e93cc36688ba07d3677d5c1689b61f246f05d08092bbf86ddbba8a5ec49648e6825b950ef17729dc064da50d50b793475a288862a0461976876807170