]> Untitled Git - bdk/log
bdk
20 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

20 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

20 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

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

20 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

20 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

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

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

20 months agoMerge bitcoindevkit/bdk#1397: Introduce proptesting, starting with `CheckPoint::range`
志宇 [Fri, 12 Apr 2024 05:29:26 +0000 (13:29 +0800)]
Merge bitcoindevkit/bdk#1397: Introduce proptesting, starting with `CheckPoint::range`

446b045161ebad3fbdf0ea96e8ff6f9da8ad212c test(chain): introduce proptest for `CheckPoint::range` (志宇)

Pull request description:

  ### Description

  This is based on #1369. It made sense for me to introduce the `CheckPoint::range` test as a proptest. I think we should also start introducing it for other methods too.

  ### Changelog notice

  * Added proptest for `CheckPoint::range`.

  ### Checklists

  #### All Submissions:

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

  #### New Features:

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

Top commit has no ACKs.

Tree-SHA512: 2d8aad5a1ad152413fbc716fed4a47ad621e723928c5331728da2fbade995ebd677acfa05d2e7639d74d0f66e0971c72582d9cd562ea008b012774057b480d62

20 months agotest(chain): introduce proptest for `CheckPoint::range`
志宇 [Fri, 5 Apr 2024 08:43:13 +0000 (16:43 +0800)]
test(chain): introduce proptest for `CheckPoint::range`

Ensure that `CheckPoint::range` returns expected values by comparing
against values returned from a primitive approach.

I think it is a good idea to start writing proptests for this crate.

20 months agoMerge bitcoindevkit/bdk#1385: Fix last seen unconfirmed
志宇 [Thu, 11 Apr 2024 13:32:57 +0000 (21:32 +0800)]
Merge bitcoindevkit/bdk#1385: Fix last seen unconfirmed

a2a64ffb6e92baf46a912f36294f3f4f521a528a fix(electrum)!: Remove `seen_at` param from `into_tx_graph` (valued mammal)
37fca35ddede6cbc9d9428a2722eff82a405b1b2 feat(tx_graph): Add method update_last_seen_unconfirmed (valued mammal)

Pull request description:

  A method `update_last_seen_unconfirmed` is added for `TxGraph` that allows inserting a `seen_at` time for all unanchored transactions.

  fixes #1336

  ### Changelog notice

  Changed:
  - Methods `into_tx_graph` and `into_confirmation_time_tx_graph`for `RelevantTxids` are changed to no longer accept a `seen_at` parameter.

  Added:
  - Added method `update_last_seen_unconfirmed` for `TxGraph`.

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

Tree-SHA512: 9011e63314b0e3ffcd50dbf5024f82b365bab1cc834c0455d7410b682338339ed5284caa721ffc267c65fa26d35ff6ee86cde6052e82a6a79768547fbb7a45eb

20 months agoUpgrade miniscript/bitcoin dependency
Tobin C. Harding [Mon, 16 Oct 2023 08:51:53 +0000 (19:51 +1100)]
Upgrade miniscript/bitcoin dependency

Upgrade:

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

Note: The bitcoin upgrade includes improvements to the
`Transaction::weight()` function, it appears those guys did good, we
no longer need to add the 2 additional weight units "just in case".

20 months agofix(electrum)!: Remove `seen_at` param from `into_tx_graph`
valued mammal [Tue, 2 Apr 2024 14:19:56 +0000 (10:19 -0400)]
fix(electrum)!: Remove `seen_at` param from `into_tx_graph`

and `into_confirmation_time_tx_graph`, since now it makes
sense to use `TxGraph::update_last_seen_unconfirmed`.

Also, use `update_last_seen_unconfirmed` in examples for
electrum/esplora. We show how to update the last seen
time for transactions by calling `update_last_seen_unconfirmed`
on the graph update returned from a blockchain source, passing
in the current time, before applying it to another `TxGraph`.

20 months agofeat(tx_graph): Add method update_last_seen_unconfirmed
valued mammal [Sat, 30 Mar 2024 01:37:38 +0000 (21:37 -0400)]
feat(tx_graph): Add method update_last_seen_unconfirmed

That accepts a `u64` as param representing the latest timestamp
and internally calls `insert_seen_at` for all transactions in
graph that aren't yet anchored in a confirmed block.

20 months agoMerge bitcoindevkit/bdk#1369: feat(chain): add `get` and `range` methods to `CheckPoint`
志宇 [Sat, 6 Apr 2024 02:16:33 +0000 (10:16 +0800)]
Merge bitcoindevkit/bdk#1369: feat(chain): add `get` and `range` methods to `CheckPoint`

53942cced492138174638a8087b08f643a8d41ad chore(chain)!: rm `From<LocalChain> for BTreeMap<u32, BlockHash>` (志宇)
2d1d95a6850a5bab9c5bf369a498fe090852cd93 feat(chain): impl `PartialEq` on `CheckPoint` (志宇)
9a62d56900a33a519dd0165ccdb91711917772f3 feat(chain): add `get` and `range` methods to `CheckPoint` (志宇)

Pull request description:

  Partially fixes #1354

  ### Description

  These methods allow us to query for checkpoints contained within the linked list by height and height range. This is useful to determine checkpoints to fetch for chain sources without having to refer back to the `LocalChain`.

  Currently this is not implemented efficiently, but in the future, we will change `CheckPoint` to use a skip list structure.

  ### Notes to the reviewers

  Please refer to the conversation in #1354 for more details. In summary, both `TxGraph::missing_heights` and `tx_graph::ChangeSet::missing_heights_from` are problematic in their own ways. Additionally, it's a better API for chain sources if we only need to lock our receiving structures twice (once to obtain initial state and once for applying the update). Instead of relying on methods such as `EsploraExt::update_local_chain` to get relevant checkpoints, we can use these query methods instead. This allows up to get rid of `::missing_heights`-esc methods and remove the need to lock receiving structures in the middle of the sync.

  ### Changelog notice

  * Added `get` and `range` methods to `CheckPoint` (and in turn, `LocalChain`). This simulates an API where we have implemented a skip list of checkpoints (to implement in the future). This is a better API because we can query for any height or height range with just a checkpoint tip instead of relying on a separate checkpoint index (which needs to live in `LocalChain`).
  * Changed `LocalChain` to have a faster `Eq` implementation. We now maintain an xor value of all checkpoint block hashes. We compare this xor value to determine whether two chains are equal.
  * Added `PartialEq` implementation for `CheckPoint` and `local_chain::Update`.

  ### Checklists

  #### All Submissions:

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

  #### New Features:

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

ACKs for top commit:
  LLFourn:
    ACK 53942cced492138174638a8087b08f643a8d41ad

Tree-SHA512: 90ef8047fe1265daa54c9dfe8a8c520685c898a50d18efd6e803707fcb529d0790d20373c9e439b9c7ff301db32b47453020cae7db4da2ea64eba895aa047f30

21 months agochore(chain)!: rm `From<LocalChain> for BTreeMap<u32, BlockHash>`
志宇 [Fri, 5 Apr 2024 07:59:09 +0000 (15:59 +0800)]
chore(chain)!: rm `From<LocalChain> for BTreeMap<u32, BlockHash>`

I don't think this was ever used. The only possible usecase I can think
of is for tests, but I don't think that is a strong enough incentive for
us to keep this.

21 months agofeat(chain): impl `PartialEq` on `CheckPoint`
志宇 [Mon, 25 Mar 2024 04:30:31 +0000 (12:30 +0800)]
feat(chain): impl `PartialEq` on `CheckPoint`

We impl `PartialEq` on `CheckPoint` instead of directly on `LocalChain`.
We also made the implementation more efficient.

21 months agofeat(chain): add `get` and `range` methods to `CheckPoint`
志宇 [Wed, 6 Mar 2024 05:04:12 +0000 (13:04 +0800)]
feat(chain): add `get` and `range` methods to `CheckPoint`

These methods allow us to query for checkpoints contained within the
linked list by height and height range. This is useful to determine
checkpoints to fetch for chain sources without having to refer back to
the `LocalChain`.

Currently this is not implemented efficiently, but in the future, we
will change `CheckPoint` to use a skip list structure.

21 months agoMerge bitcoindevkit/bdk#1345: fix: remove deprecated max_satisfaction_weight
志宇 [Tue, 2 Apr 2024 11:21:18 +0000 (19:21 +0800)]
Merge bitcoindevkit/bdk#1345: fix: remove deprecated max_satisfaction_weight

798ed8ced25156049126645435127a22245e916f fix: remove deprecated `max_satisfaction_weight (Jose Storopoli)

Pull request description:

  ### Description
  Continuation of #1115.
  Closes #1036.

  * Change deprecated `max_satisfaction_weight` to `max_weight_to_satisfy`
  * Remove `#[allow(deprecated)]` flags

  ### Notes to the reviewers

  I've changed all `max_satisfaction_weight()` to `max_weight_to_satisfy()` in `Wallet.get_available_utxo()` and `Wallet.build_fee_bump()`. Checking the docs on the `miniscript` crate for `max_weight_to_satisfy` has the following note:

  We are testing if the underlying descriptor `is.segwit()` or `.is_taproot`,
  then adding 4WU if true or leaving as it is otherwise.

  Another thing, we are not testing in BDK tests for legacy (pre-segwit) descriptors.
  Should I also add them to this PR?

  ### Changelog notice
  ### Fixed
  Replace the deprecated `max_satisfaction_weight` from `rust-miniscript` to `max_weight_to_satisfy`.

  ### 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
  * [ ]  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 798ed8ced25156049126645435127a22245e916f

Tree-SHA512: 60babecee13c24915348ddb64894127a76a59d9421d52ea37acc714913685d57cc2be1904f9d0508078dd1db1f7d7dad83a734af5ee981801ca87de2e9984429

21 months agoMerge bitcoindevkit/bdk#1373: Wrap transactions as `Arc<Transaction>` in `TxGraph`
志宇 [Sun, 31 Mar 2024 09:50:00 +0000 (17:50 +0800)]
Merge bitcoindevkit/bdk#1373: Wrap transactions as `Arc<Transaction>` in `TxGraph`

8ab58af093ff295b86c3f8189aa96dea313092c4 feat(chain)!: wrap `TxGraph` txs with `Arc` (志宇)

Pull request description:

  ### Description

  This PR makes `TxGraph` store transactions as `Arc<Transaction>`.

  `Arc<Transaction>` can be shared between the chain-source and receiving structures. This allows the chain-source to keep the already-fetched transactions (save bandwith) and have a shared pointer to the transaction (save memory).

  Our current logic to avoid re-fetching transactions is to refer back to the receiving structures. However, this means an additional round of locking our receiving structures.

  ### Notes to the reviewers

  This will make more sense once I update the esplora/electrum chain sources to make use of both #1369 and this PR. The result would be chain sources which would only require locking the receiving structures twice (once for initiating the update, and once for applying the update).

  ### Changelog notice

  * Changed `TxGraph` to store transactions as `Arc<Transaction>`. This allows chain-sources to cheaply keep a copy of already-fetched transactions.

  ### 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:
  LLFourn:
    ACK 8ab58af093ff295b86c3f8189aa96dea313092c4
  notmandatory:
    ACK 8ab58af093ff295b86c3f8189aa96dea313092c4

Tree-SHA512: 81d7ad35fed7f253a3b902f09a41aaef2877f6201d4f6e78318741bf00e4b898a8000d878ffcbfe75701094ce3e9021bd718b190a655331a9e11f0ad66bdb02f

21 months agofix: remove deprecated `max_satisfaction_weight
Jose Storopoli [Sun, 10 Sep 2023 09:53:56 +0000 (05:53 -0400)]
fix: remove deprecated `max_satisfaction_weight

- Change deprecated `max_satisfaction_weight` to `max_weight_to_satisfy`
- Remove `#[allow(deprecated)]` flags
- updates the calculations in TXIN_BASE_WEIGHT and P2WPKH_SATISFACTION_SIZE

Update crates/bdk/src/wallet/coin_selection.rs

Co-authored-by: ValuedMammal <valuedmammal@protonmail.com>
21 months agoMerge bitcoindevkit/bdk#1389: Bump bdk version to 1.0.0-alpha.8 v1.0.0-alpha.8
Steve Myers [Wed, 27 Mar 2024 16:13:24 +0000 (11:13 -0500)]
Merge bitcoindevkit/bdk#1389: Bump bdk version to 1.0.0-alpha.8

7b97c956c7abdd6415ccdda79c26cf212e15cb4e Bump bdk version to 1.0.0-alpha.8 (Steve Myers)

Pull request description:

  ### Description

  Bump versions:

  bdk version to 1.0.0-alpha.8
  bdk_bitcoind_rpc to 0.7.0
  bdk_electrum to 0.10.0
  bdk_esplora to 0.10.0
  bdk_file_store to 0.8.0
  bdk_hwi to 0.2.0

  fixes #1388

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

Tree-SHA512: 32286f33f8fe595f79ef6b9450c7906dee15b5c93ad62435025f4fb1446f9ee8c6147190d628b95e21b8f36c02ca3f8b86b8a5e8cab3835773750967f9e36489

21 months agoBump bdk version to 1.0.0-alpha.8
Steve Myers [Tue, 26 Mar 2024 18:35:10 +0000 (13:35 -0500)]
Bump bdk version to 1.0.0-alpha.8

bdk_bitcoind_rpc to 0.7.0
bdk_electrum to 0.10.0
bdk_esplora to 0.10.0
bdk_file_store to 0.8.0
bdk_hwi to 0.2.0

21 months agoMerge bitcoindevkit/bdk#1391: Fix cargo manifest for `bdk_testenv`
志宇 [Wed, 27 Mar 2024 07:12:22 +0000 (15:12 +0800)]
Merge bitcoindevkit/bdk#1391: Fix cargo manifest for `bdk_testenv`

25800139124a37608c9da0a6ad76c22795f110d6 chore(testenv): fix cargo manifest (志宇)

Pull request description:

  ### Description

  This will make the `bdk_testenv` crate actually publishable.

  ### Changelog notice

  * Fix cargo manifest of `bdk_testenv`.

  ### Checklists

  #### All Submissions:

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

ACKs for top commit:
  LLFourn:
    ACK 25800139124a37608c9da0a6ad76c22795f110d6

Tree-SHA512: 52707450473713490cb1115af06747dc4d6f78cf4bf877cd3a246064af11786b5a89829731e911ffba19a71db9b19a60ad5b12f20871d57b296427761707d826

21 months agochore(testenv): fix cargo manifest
志宇 [Wed, 27 Mar 2024 06:58:46 +0000 (14:58 +0800)]
chore(testenv): fix cargo manifest

21 months agoMerge bitcoindevkit/bdk#1351: fix: define and document `stop_gap`
Steve Myers [Tue, 26 Mar 2024 23:59:13 +0000 (18:59 -0500)]
Merge bitcoindevkit/bdk#1351: fix: define and document `stop_gap`

7c1861aab9a76f2ba4a2ae372a16c9669a33f5de fix: define and document `stop_gap` (Jose Storopoli)

Pull request description:

  ### Description

  - changes the code implementation to "the maximum number of consecutive unused addresses" in esplora async and blocking extensions.
  - for all purposes treats `stop_gap = 0` as `stop_gap = 1`.
  - renames `past_gap_limit` to `gap_limit_reached` to indicate we want to break once the gap limit is reached and not go further in `full_scan`, as suggested in https://github.com/bitcoindevkit/bdk/issues/1227#issuecomment-1859040463
  - change the tests according to the new implementation.
  - add notes on what `stop_gap` means and links to convergent definition in other Bitcoin-related software.

  Closes #1227.

  ### Notes to the reviewers

  We can iterate over the wording and presentation of the `stop_gap` definition
  and details.

  ### Changelog notice

  - BREAKING: change `stop_gap` definition and effects in `full_scan`
    to reflect the common definitions in most Bitcoin-related software.

  ### 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
  * [x] I've added tests to reproduce the issue which are now passing
  * [x] I'm linking the issue being fixed by this PR

ACKs for top commit:
  notmandatory:
    ACK 7c1861aab9a76f2ba4a2ae372a16c9669a33f5de

Tree-SHA512: d9bc5f8ebace47fa33f023ceddb3df5629ad3e7fa130a407311a0303ac59810e6527254efb9075f9e87bf37bec8655c4726eb9cb99f6b038fbeb742f79e995c0

21 months agofix: define and document `stop_gap`
Jose Storopoli [Tue, 26 Mar 2024 15:44:03 +0000 (12:44 -0300)]
fix: define and document `stop_gap`

- changes the code implementation to "the maximum number of consecutive unused addresses"
  in esplora async and blocking extjensions.
- treat `stop_gap = 0` as `stop_gap = 1` for all purposes.
- renames `past_gap_limit` to `gap_limit_reached` to indicate we want to break once the gap
  limit is reached and not go further in `full_scan`, as suggested in
  https://github.com/bitcoindevkit/bdk/issues/1227#issuecomment-1859040463
- change the tests according to the new implementation.
- add notes on what `stop_gap` means and links to convergent definition in other
  Bitcoin-related software.

Closes #1227

21 months agofeat(chain)!: wrap `TxGraph` txs with `Arc`
志宇 [Thu, 14 Mar 2024 06:20:51 +0000 (14:20 +0800)]
feat(chain)!: wrap `TxGraph` txs with `Arc`

Wrapping transactions as `Arc<Transaction>` allows us to share
transactions cheaply between the chain-source and receiving structures.
Therefore the chain-source can keep already-fetched transactions (save
bandwidth) and have a shared pointer to the transactions (save memory).

This is better than the current way we do things, which is to refer back
to the receiving structures mid-sync.

Documentation for `TxGraph` is also updated.

21 months agoMerge bitcoindevkit/bdk#1171: chore: extract `TestEnv` into separate crate
志宇 [Sat, 23 Mar 2024 10:37:20 +0000 (18:37 +0800)]
Merge bitcoindevkit/bdk#1171: chore: extract `TestEnv` into separate crate

7c9ba3cfc855dc0845476fe923dac4e47cb5c06a chore(electrum,testenv): move `test_reorg_is_detected_in_electrsd` (志宇)
2462e9041599f395673f9b14f0b618877832f099 chore(esplora): rm custom WASM target spec test dependency (志宇)
04d0ab5a978fbfd45a5c795f9142ff4a9ba29ee3 test(electrum): added scan and reorg tests Added scan and reorg tests to check electrum functionality using `TestEnv`. (Wei Chen)
4edf533b678cb21f4c29ded22692e607ff75e2cd chore: extract `TestEnv` into separate crate `TestEnv` is extracted into its own crate to serve as a framework for testing other block explorer APIs. (Wei Chen)
6e648fd5afa188290b05f8e050ba69fe5f8b80e4 chore: update MSRV dependency for nightly docs (Wei Chen)

Pull request description:

  ### Description

  `TestEnv` is extracted into its own crate with `electrsd` support added so that `TestEnv` can also serve `esplora` and `electrum`.
  The tests in the `esplora` crate have also been updated to use `TestEnv`.

  The `tx_can_become_unconfirmed_after_reorg()` test in `test_electrum` suggests that the electrum issue where a reorged tx would be stuck at confirmed does not exist anymore.

  ### Notes to the reviewers

  The code for `tx_can_become_unconfirmed_after_reorg()` was adapted from the same test in `bitcoind_rpc/test_emitter`. This electrum version of the test requires extra review, as I am uncertain if I used the API efficiently.

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

Tree-SHA512: 36c6501e477abb7ae68073b6f4776f1f69f8964010ab758aa3677aae96df10f2cb632421872cacd73b37123d6db8a9dbefb5b6416e0dd524b712bf3fc56b7139

21 months agochore(electrum,testenv): move `test_reorg_is_detected_in_electrsd`
志宇 [Sat, 23 Mar 2024 10:28:49 +0000 (18:28 +0800)]
chore(electrum,testenv): move `test_reorg_is_detected_in_electrsd`

21 months agochore(esplora): rm custom WASM target spec test dependency
志宇 [Sat, 23 Mar 2024 09:57:27 +0000 (17:57 +0800)]
chore(esplora): rm custom WASM target spec test dependency

None of the `bdk_esplora` tests can run under WASM anyway since we
depend on `electrsd`.

21 months agotest(electrum): added scan and reorg tests
Wei Chen [Fri, 2 Feb 2024 10:35:24 +0000 (18:35 +0800)]
test(electrum): added scan and reorg tests
Added scan and reorg tests to check electrum functionality using
`TestEnv`.

21 months agochore: extract `TestEnv` into separate crate
Wei Chen [Fri, 2 Feb 2024 10:33:18 +0000 (18:33 +0800)]
chore: extract `TestEnv` into separate crate
`TestEnv` is extracted into its own crate to serve as a framework
for testing other block explorer APIs.

21 months agochore: update MSRV dependency for nightly docs
Wei Chen [Wed, 20 Mar 2024 08:02:05 +0000 (16:02 +0800)]
chore: update MSRV dependency for nightly docs

21 months agoMerge bitcoindevkit/bdk#1378: Update bdk README
志宇 [Fri, 22 Mar 2024 07:05:44 +0000 (15:05 +0800)]
Merge bitcoindevkit/bdk#1378: Update bdk README

06d7dc5c3a890f0a141de4cf6f421fe766d99ec3 doc(bdk): Update bdk README (vmammal)

Pull request description:

  fixes #1044

  ### Notes

  The code snippet is a compile fail because variables `txout` and `outpoint` are not initialized. Any other suggestions are welcome.

  There is still some old commented code in the file that's probably not needed unless we want to provide another example snippet, say for getting new address info.

  * [x] Fix broken links
  * [x] Use a new unused tprv
  * [ ] Try to make persistence example make sense, or maybe just do away with it

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

Tree-SHA512: 09a671bc6bea574d7a4b42b64718380ee71a0c5d36c6b7ca1dc19a2c567de510b27ccc91fe05e7178bf31c562db66bc64f660415de5bb2f32f369b13c44ad3d2

21 months agoMerge bitcoindevkit/bdk#1310: Remove extra taproot fields when finalizing PSBT
志宇 [Fri, 22 Mar 2024 04:38:42 +0000 (12:38 +0800)]
Merge bitcoindevkit/bdk#1310: Remove extra taproot fields when finalizing PSBT

5840ce473e430de4c4e3698734e9667cc476fee4 fix(bdk): Remove extra taproot fields when finalizing Psbt (vmammal)
8c78a42163dee06b640f46d74255df37dbc53873 test(psbt): Fixup test_psbt_multiple_internalkey_signers (vmammal)

Pull request description:

  We currently allow removing `partial_sigs` from a finalized PSBT, which is relevant to non-taproot inputs, however taproot related PSBT fields were left in place despite the recommendation of BIP371 to remove them once the `final_script_witness` is constructed. This can cause confusion for parsers that encounter extra taproot metadata in an already satisfied input.

  Fix this by introducing a new member to SignOptions `remove_taproot_extras`, which when true will remove extra taproot related data from a PSBT upon successful finalization. This change makes removal of all taproot extras the default but configurable.

  fixes #1243

  ### Notes to the reviewers

  If there's a better or more descriptive name for `remove_taproot_extras`, I'm open to changing it.

  ### Changelog notice

  Fixed an [issue](https://github.com/bitcoindevkit/bdk/issues/1243) finalizing taproot inputs following BIP371

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

ACKs for top commit:
  evanlinjin:
    ACK 5840ce473e430de4c4e3698734e9667cc476fee4

Tree-SHA512: 69f022c6f736500590e36880dd2c845321464f89af6a2c67987d1c520f70a298328363cade0f55f270c4e7169e740bd4ada752ec2c75afa02b6a5a851f9030c3

21 months agoMerge bitcoindevkit/bdk#1216: Migrate to bitcoin::FeeRate
志宇 [Fri, 22 Mar 2024 04:34:01 +0000 (12:34 +0800)]
Merge bitcoindevkit/bdk#1216: Migrate to bitcoin::FeeRate

475a77219a6e7649c91b7cfeb44871cee9d0f374 refactor(bdk)!: Remove trait Vbytes (vmammal)
0d64beb040e885d653adb901dc49482f9daafddf chore: organize some imports (vmammal)
89608ddd0fd582d011f7b7ae8bbeb63dee6a3b99 refactor(bdk): display CreateTxError::FeeRateTooLow in sat/vb (vmammal)
09bd86e2d82020d5f4079c5d234888a9eed50489 test(bdk): initialize all feerates from `u64` (vmammal)
004957dc2969171b7a37ce92d2cdb0e8f22b6da5 refactor(bdk)!: drop FeeRate from bdk::types (vmammal)

Pull request description:

  ### Description

  This follows a similar approach to #1141 namely to remove `FeeRate` from `bdk::types` and instead defer to the upstream implementation for all fee rates. The idea is that making the switch allows BDK to benefit from a higher level abstraction, leaving the implementation details largely hidden.

  As noted in #774, we should avoid extraneous conversions that can result in deviations in estimated transaction size and calculated fee amounts, etc. This would happen for example whenever calling a method like `FeeRate::to_sat_per_vb_ceil`. The only exception I would make is if we must return a fee rate error to the user, we might prefer to display it in the more familiar sats/vb, but this would only be useful if the rate can be expressed as a float.

  ### Notes to the reviewers

  `bitcoin::FeeRate` is an integer whose native unit is sats per kilo-weight unit. In order to facilitate the change, a helper method `feerate_unchecked` is added and used only in wallet tests and psbt tests as necessary to convert existing fee rates to the new type. It's "unchecked" in the sense that we're not checking for integer overflow, because it's assumed we're passing a valid fee rate in a unit test.

  Potential follow-ups can include:
  - [x] Constructing a proper `FeeRate` from a `u64` in all unit tests, and thus obviating the need for the helper `feerate_unchecked` going forward.
  - [x] Remove trait `Vbytes`.
  - Consider adding an extra check that the argument to `TxBuilder::drain_to` is within "standard" size limits.
  - Consider refactoring `coin_selection::select_sorted_utxos` to be efficient and readable.

  closes #1136

  ### Changelog notice

  - Removed `FeeRate` type. All fee rates are now rust-bitcoin [`FeeRate`](https://docs.rs/bitcoin/latest/bitcoin/blockdata/fee_rate/struct.FeeRate.html).
  - Removed trait `Vbytes`.

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

Tree-SHA512: 511dab8aa7a65d2b15b160cb4feb96964e8401bb04cda4ef0f0244524bf23a575b3739783a14b90d2dccc984b3f30f5dabfb0a890ffe7c897c2dc23ba301bcaf

21 months agorefactor(bdk)!: Remove trait Vbytes
vmammal [Sat, 2 Mar 2024 14:48:16 +0000 (09:48 -0500)]
refactor(bdk)!: Remove trait Vbytes

The only place this is being used is a unit test that is
easily refactored. For size conversions prefer methods
on e.g. `Weight`.

21 months agochore: organize some imports
vmammal [Thu, 16 Nov 2023 23:45:21 +0000 (18:45 -0500)]
chore: organize some imports

21 months agorefactor(bdk): display CreateTxError::FeeRateTooLow in sat/vb
vmammal [Thu, 16 Nov 2023 23:13:44 +0000 (18:13 -0500)]
refactor(bdk): display CreateTxError::FeeRateTooLow in sat/vb

Also modify a unit test `test_bump_fee_low_fee_rate` to
additionally assert the expected error message

21 months agotest(bdk): initialize all feerates from `u64`
vmammal [Thu, 16 Nov 2023 23:09:20 +0000 (18:09 -0500)]
test(bdk): initialize all feerates from `u64`

This makes the helper `feerate_unchecked` now redundant but
still usable.

21 months agorefactor(bdk)!: drop FeeRate from bdk::types
vmammal [Thu, 16 Nov 2023 23:00:58 +0000 (18:00 -0500)]
refactor(bdk)!: drop FeeRate from bdk::types

Adopt `bitcoin::FeeRate` throughout

21 months agoMerge pull request #1384 from evanlinjin/file_store_clippy_happy
Lloyd Fournier [Fri, 22 Mar 2024 00:48:34 +0000 (11:48 +1100)]
Merge pull request #1384 from evanlinjin/file_store_clippy_happy

Explicitly state that we truncate file for `create_new`

21 months agochore(file_store): explicitly state that we truncate file for `create_new`
志宇 [Thu, 21 Mar 2024 23:41:17 +0000 (07:41 +0800)]
chore(file_store): explicitly state that we truncate file for `create_new`

This makes clippy happy.

21 months agodoc(bdk): Update bdk README
vmammal [Thu, 15 Feb 2024 06:32:09 +0000 (01:32 -0500)]
doc(bdk): Update bdk README

22 months agoMerge bitcoindevkit/bdk#1365: Bump bdk version to 1.0.0-alpha.7 v1.0.0-alpha.7
Steve Myers [Tue, 5 Mar 2024 03:38:40 +0000 (21:38 -0600)]
Merge bitcoindevkit/bdk#1365: Bump bdk version to 1.0.0-alpha.7

fef70d5e8fe1903aa532897e1093b1b972e08055 Bump version to 1.0.0-alpha.7 (Steve Myers)

Pull request description:

  Bump bdk version to 1.0.0-alpha.7

  bdk_chain to 0.11.0
  bdk_bitcoind_rpc to 0.6.0
  bdk_electrum to 0.9.0
  bdk_esplora to 0.9.0
  bdk_file_store to 0.7.0

  fixes #1364

ACKs for top commit:
  danielabrozzoni:
    ACK fef70d5e8fe1903aa532897e1093b1b972e08055

Tree-SHA512: 94ba5cad102d89122897436390d4ababf49a19cf97f4118c0804b3288955dd591b543d4605268dcc1967f34e523a0c4058b06f9cd74c7e8c4394e902abc17022

22 months agoBump version to 1.0.0-alpha.7
Steve Myers [Sat, 2 Mar 2024 17:05:30 +0000 (11:05 -0600)]
Bump version to 1.0.0-alpha.7

bdk_chain to 0.11.0
bdk_bitcoind_rpc to 0.6.0
bdk_electrum to 0.9.0
bdk_esplora to 0.9.0
bdk_file_store to 0.7.0

22 months agoMerge bitcoindevkit/bdk#1349: Fix `KeychainTxOutIndex::lookahead_to_target`
Steve Myers [Sat, 2 Mar 2024 16:38:40 +0000 (10:38 -0600)]
Merge bitcoindevkit/bdk#1349: Fix `KeychainTxOutIndex::lookahead_to_target`

b290b2950221578d73c3194a1accfd080f83631a test(chain): change test case comments to docstring (志宇)
c151d8fd230fb87f27aadb965157f94f01f021a2 fix(chain): `KeychainTxOutIndex::lookahead_to_target` (志宇)

Pull request description:

  ### Description

  This method was not used (so it was untested) and it was not working. This fixes it.

  The old implementation used `.next_store_index` which returned the keychain's last index stored in `.inner` (which include lookahead spks). This is WRONG because `.replenish_lookahead` needs the difference from last revealed.

  ### Changelog notice

  Fix `KeychainTxOutIndex::lookahead_to_target`

  ### Checklists

  #### All Submissions:

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

  #### Bugfixes:

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

ACKs for top commit:
  notmandatory:
    ACK b290b2950221578d73c3194a1accfd080f83631a

Tree-SHA512: af50c6af18b6b57494cfa37f89b0236674fa331091d791e858f67b7d0b3a1e4e11e7422029bd6a2dc1c795914cdf6d592a14b42a62ca7c7c475ba6ed37182539

22 months agofix(bdk): Remove extra taproot fields when finalizing Psbt
vmammal [Wed, 31 Jan 2024 21:18:09 +0000 (16:18 -0500)]
fix(bdk): Remove extra taproot fields when finalizing Psbt

We currently allow removing `partial_sigs` from a finalized Psbt,
which is relevant to non-taproot inputs, however taproot related Psbt
fields were left in place despite the recommendation of BIP371 to remove
them once the `final_script_witness` is constructed. This can cause
confusion for parsers that encounter extra taproot metadata in an
already satisfied input.

Fix this by introducing a new member to SignOptions
`remove_taproot_extras`, which when true will remove extra taproot
related data from a Psbt upon successful finalization. This change
makes removal of all taproot extras the default but configurable.

test(wallet): Add test
`test_taproot_remove_tapfields_after_finalize_sign_option`
that checks various fields have been cleared for taproot
Psbt `Input`s and `Output`s according to BIP371.

22 months agotest(chain): change test case comments to docstring
志宇 [Wed, 28 Feb 2024 08:47:25 +0000 (05:47 -0300)]
test(chain): change test case comments to docstring

22 months agotest(psbt): Fixup test_psbt_multiple_internalkey_signers
vmammal [Sun, 11 Feb 2024 20:32:36 +0000 (15:32 -0500)]
test(psbt): Fixup test_psbt_multiple_internalkey_signers

to verify the signature of the input and ensure the right internal
key is used to sign. This fixes a shortcoming of a previous
version of the test that relied on the result of `finalize_psbt`
but would have erroneously allowed signing with the wrong key.

22 months agoMerge bitcoindevkit/bdk#1344: tx_builder: Relax generic constraints on TxBuilder
Daniela Brozzoni [Thu, 22 Feb 2024 15:32:30 +0000 (16:32 +0100)]
Merge bitcoindevkit/bdk#1344: tx_builder: Relax generic constraints on TxBuilder

2efa299d0486e0b08376a062e86c6ca8e03916da tx_builder: Relax generic constraints on TxBuilder (Steven Roose)

Pull request description:

  Closes https://github.com/bitcoindevkit/bdk/issues/1312

ACKs for top commit:
  danielabrozzoni:
    ACK 2efa299d0486e0b08376a062e86c6ca8e03916da

Tree-SHA512: 6bfe052c22697eb910cf1f3d453e89f4432159fa017b38532d097cdc07b7a7c3b986be658b81e51acdb54cab999345ab463184e80c8eacefc73d77748c018992

22 months agoMerge bitcoindevkit/bdk#1357: ci: Remove jobserver pin
Steve Myers [Thu, 22 Feb 2024 00:42:35 +0000 (18:42 -0600)]
Merge bitcoindevkit/bdk#1357: ci: Remove jobserver pin

2647aff4bc030e3b63287d353fb6293ab2f1442c ci: Remove jobserver pin (Daniela Brozzoni)

Pull request description:

ACKs for top commit:
  evanlinjin:
    ACK 2647aff4bc030e3b63287d353fb6293ab2f1442c

Tree-SHA512: bb3821c44a1d4fb7a84b8e548b9545c74b4ae84feca4d434791c041618dc9a2f03d8c3a64183844fb5b19dfbfa1c19716191e9810d443d6ddc449f171317a20e

22 months agotx_builder: Relax generic constraints on TxBuilder
Steven Roose [Wed, 14 Feb 2024 15:50:00 +0000 (15:50 +0000)]
tx_builder: Relax generic constraints on TxBuilder

22 months agoci: Remove jobserver pin
Daniela Brozzoni [Wed, 21 Feb 2024 12:24:31 +0000 (13:24 +0100)]
ci: Remove jobserver pin

It is not needed anymore. Discovered in #1344

22 months agofix(chain): `KeychainTxOutIndex::lookahead_to_target`
志宇 [Fri, 16 Feb 2024 18:20:44 +0000 (02:20 +0800)]
fix(chain): `KeychainTxOutIndex::lookahead_to_target`

22 months agoMerge bitcoindevkit/bdk#1325: Add `map_anchors` for `TxGraph`
志宇 [Fri, 16 Feb 2024 18:29:39 +0000 (02:29 +0800)]
Merge bitcoindevkit/bdk#1325: Add `map_anchors` for `TxGraph`

5489f905a434ecc06867603c7c421e3e50d993ca feat(chain): add `map_anchors` for `TxGraph` and `ChangeSet` (Antonio Yang)
022d5a21cff6c46fb869f8fd538b4026e531ee57 test(chain) use `Anchor` generic on `init_graph` (Antonio Yang)

Pull request description:

  ### Description
  Fix #1295

  ### 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:
  evanlinjin:
    ACK 5489f905a434ecc06867603c7c421e3e50d993ca
  LLFourn:
    ACK 5489f905a434ecc06867603c7c421e3e50d993ca

Tree-SHA512: c8327f2e7035a46208eb32c6da1f9f0bc3e8625168450c5b0b39f695268e42b0b9053b6eb97805b116328195d77af7ca9edb1f12206c50513fbe295dded542e7

22 months agoMerge bitcoindevkit/bdk#1347: Bump bdk version to 1.0.0-alpha.6 v1.0.0-alpha.6
Steve Myers [Thu, 15 Feb 2024 17:20:21 +0000 (11:20 -0600)]
Merge bitcoindevkit/bdk#1347: Bump bdk version to 1.0.0-alpha.6

83798390108ef37443dbe2d6ec0d35a346e69957 Bump version to 1.0.0-alpha.6 (Steve Myers)

Pull request description:

  ### Description

  Fixes #1343

  Bump bdk version to 1.0.0-alpha.6, also bump:

  bdk_chain to 0.10.0
  bdk_bitcoind_rpc to 0.5.0
  bdk_electrum to 0.8.0
  bdk_esplora to 0.8.0
  bdk_file_store to 0.6.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:
  danielabrozzoni:
    utACK 83798390108ef37443dbe2d6ec0d35a346e69957

Tree-SHA512: b16a8f88ab66ed78d6f6402d60acfa79b2371a12580a277f9bb3d3df212fb608a8305b6f5082bb280b9a18e209c70be0db38c893fff2f5c1f6085a99e3819479

22 months agoBump version to 1.0.0-alpha.6
Steve Myers [Thu, 15 Feb 2024 16:23:05 +0000 (10:23 -0600)]
Bump version to 1.0.0-alpha.6

bdk_chain to 0.10.0
bdk_bitcoind_rpc to 0.5.0
bdk_electrum to 0.8.0
bdk_esplora to 0.8.0
bdk_file_store to 0.6.0

22 months agofeat(chain): add `map_anchors` for `TxGraph` and `ChangeSet`
Antonio Yang [Tue, 13 Feb 2024 13:29:12 +0000 (21:29 +0800)]
feat(chain): add `map_anchors` for `TxGraph` and `ChangeSet`

22 months agoMerge bitcoindevkit/bdk#1335: fix(chain): tx_graph::ChangeSet::is_empty
志宇 [Sun, 11 Feb 2024 09:48:42 +0000 (17:48 +0800)]
Merge bitcoindevkit/bdk#1335: fix(chain): tx_graph::ChangeSet::is_empty

13ab5a835d59341e387fbbefec12fe4f48e5f3c8 chore(chain): Improve TxGraph::ChangeSet docs (LLFourn)
dbbd51424284a960a95c3801b02dc1973322725f fix(chain)!: rm duplicate `is_empty` method in tx graph changeset (志宇)
ae00e1ee7b95c622fc3992c0804dd4b4517efc7b fix(chain): tx_graph::ChangeSet::is_empty (LLFourn)

Pull request description:

  🙈

  ### Changelog notice

  - Fix bug in `tx_graph::ChangeSet::is_empty` where is returns true even when it wasn't empty

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

ACKs for top commit:
  LLFourn:
    Self-ACK: 13ab5a835d59341e387fbbefec12fe4f48e5f3c8
  evanlinjin:
    ACK 13ab5a835d59341e387fbbefec12fe4f48e5f3c8

Tree-SHA512: b9f1f17fd2ed0f8e2337a8033e1cbd3e9f15b1ad4b32da3f0eb73a30913d6798e7a08d6b297d93bd08c2e1c388226e97648650ac636846b2c7aa95c3bcefbcfd

22 months agochore(chain): Improve TxGraph::ChangeSet docs
LLFourn [Fri, 9 Feb 2024 22:13:08 +0000 (09:13 +1100)]
chore(chain): Improve TxGraph::ChangeSet docs

22 months agoMerge bitcoindevkit/bdk#1334: Reorder fields in ConfirmationHeightAnchor fields so...
志宇 [Fri, 9 Feb 2024 20:17:13 +0000 (04:17 +0800)]
Merge bitcoindevkit/bdk#1334: Reorder fields in ConfirmationHeightAnchor fields so Ord DWIM

adc95137ac2e52f4d45c4ec778703001c95a362f fix(chain)! Re-order fields in anchors so Ord DWIM (LLFourn)

Pull request description:

  Something that is confirmed more recently should be greater than something that is confirmed earlier regardless of anchor.

ACKs for top commit:
  evanlinjin:
    ACK adc95137ac2e52f4d45c4ec778703001c95a362f

Tree-SHA512: 9a588b64afc7e20b35a9abb8c25b8b82858c0f89886320c0fc91f6c61592fccfa7fbaa3020a393b1d5fd79f71302a388255b69cb3726a38a0f2fdab8bb93769c

22 months agofix(chain)!: rm duplicate `is_empty` method in tx graph changeset
志宇 [Fri, 9 Feb 2024 19:35:48 +0000 (03:35 +0800)]
fix(chain)!: rm duplicate `is_empty` method in tx graph changeset

22 months agofix(chain): tx_graph::ChangeSet::is_empty
LLFourn [Fri, 9 Feb 2024 08:43:26 +0000 (19:43 +1100)]
fix(chain): tx_graph::ChangeSet::is_empty

22 months agofix(chain)! Re-order fields in anchors so Ord DWIM
LLFourn [Fri, 9 Feb 2024 02:48:19 +0000 (13:48 +1100)]
fix(chain)! Re-order fields in anchors so Ord DWIM

22 months agotest(chain) use `Anchor` generic on `init_graph`
Antonio Yang [Thu, 8 Feb 2024 07:45:42 +0000 (15:45 +0800)]
test(chain) use `Anchor` generic on `init_graph`

22 months agoMerge bitcoindevkit/bdk#1308: feat(esplora): include previous `TxOut`s for fee calcul...
Daniela Brozzoni [Mon, 5 Feb 2024 11:44:43 +0000 (12:44 +0100)]
Merge bitcoindevkit/bdk#1308: feat(esplora): include previous `TxOut`s for fee calculation

552f11cb5f66a9366dbc05c801fcae043ebe5b82 feat(esplora): include previous `TxOut`s for fee calculation The previous `TxOut` for transactions received from an external wallet are added as floating `TxOut`s to `TxGraph` to allow for fee calculation. (Wei Chen)

Pull request description:

  ### Description

  Partially implements #1265.

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

  ### Notes to the reviewers

  Currently only the `esplora` portion of #1265 has been implemented.
  The `electrum` portion will potentially be done in a new PR, as discussed on the 1/30/24 Lib call.

  ### Checklists

  #### To Do:
  * [ ] Implement `electrum` portion of #1265.

  #### 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:
    re-ACK 552f11cb5f66a9366dbc05c801fcae043ebe5b82
  danielabrozzoni:
    ACK 552f11cb5f66a9366dbc05c801fcae043ebe5b82

Tree-SHA512: 752a24ebd0b9ad7952c1b093ecb251473e346c77b860c1a80c73418130189227405a0f0d7652967cf8c7b89994e8c37df96cd52b52b6daff9cc8c88b5194069a

22 months agoMerge bitcoindevkit/bdk#1316: tx_builder: Support setting explicit nSequence for...
Daniela Brozzoni [Mon, 5 Feb 2024 11:36:02 +0000 (12:36 +0100)]
Merge bitcoindevkit/bdk#1316: tx_builder: Support setting explicit nSequence for foreign inputs

9bb39a3a3fcdebeec53a8a771091954c845db7a5 Avoid a wildcard match in tx construction (Steven Roose)
9e098a5b6d0802eb39f3e200605b8576c77030eb tx_builder: Support setting explicit nSequence for foreign inputs (Steven Roose)

Pull request description:

  Fixes https://github.com/bitcoindevkit/bdk/issues/1315.

ACKs for top commit:
  evanlinjin:
    ACK 9bb39a3a3fcdebeec53a8a771091954c845db7a5
  danielabrozzoni:
    utACK 9bb39a3a3fcdebeec53a8a771091954c845db7a5

Tree-SHA512: 42c96a58a762fa8737402ebd0132ce20ce0359c996cee9feeecb0b84e6fb73305be1aec9429fb97ba932486f0b35ac5caed7b43656456c5fb053e55330a12d47

22 months agofeat(esplora): include previous `TxOut`s for fee calculation
Wei Chen [Wed, 31 Jan 2024 15:41:42 +0000 (23:41 +0800)]
feat(esplora): include previous `TxOut`s for fee calculation
The previous `TxOut` for transactions received from an external
wallet are added as floating `TxOut`s to `TxGraph` to allow for
fee calculation.

23 months agoMerge bitcoindevkit/bdk#1319: chore: typos
Steve Myers [Sun, 4 Feb 2024 19:18:47 +0000 (13:18 -0600)]
Merge bitcoindevkit/bdk#1319: chore: typos

8d93fad778565f44cbcc053c7f51fbc27bebf99a chore: typos (Jose Storopoli)

Pull request description:

  More caught on by Nix CI in #1257.

  ### 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:
  evanlinjin:
    ACK 8d93fad778565f44cbcc053c7f51fbc27bebf99a
  notmandatory:
    ACK 8d93fad778565f44cbcc053c7f51fbc27bebf99a

Tree-SHA512: 28e0316d457658266b2af1de76b114f87ce7485e386ddecd805dda1266a4e8645612c0fa6bc921c58daa4886558b32b538cccbb1644c96c3bab638dd7c42ee2b

23 months agochore: typos
Jose Storopoli [Sun, 4 Feb 2024 09:13:40 +0000 (06:13 -0300)]
chore: typos

More caught on by Nix CI in #1257.