]> Untitled Git - bdk/log
bdk
3 months agotest(chain): Add comprehensive tests for min_confirmations parameter
志宇 [Thu, 11 Sep 2025 03:48:27 +0000 (03:48 +0000)]
test(chain): Add comprehensive tests for min_confirmations parameter

Add test file `tests/test_canonical_view.rs` with three comprehensive test cases:

1. `test_min_confirmations_parameter`: Tests basic min_confirmations functionality
   - Verifies min_confirmations = 0 and 1 behave identically
   - Tests edge case where transaction has exactly required confirmations
   - Tests case where transaction has insufficient confirmations

2. `test_min_confirmations_with_untrusted_tx`: Tests trust predicate interaction
   - Verifies insufficient confirmations + untrusted predicate = untrusted_pending
   - Ensures trust predicate is respected when confirmations are insufficient

3. `test_min_confirmations_multiple_transactions`: Tests complex scenarios
   - Multiple transactions with different confirmation counts
   - Verifies correct categorization based on min_confirmations threshold
   - Tests both min_confirmations = 5 and min_confirmations = 10 scenarios

These tests validate that the min_confirmations parameter correctly controls
when transactions are treated as confirmed vs trusted/untrusted pending.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
3 months agofeat(chain): Add min_confirmations parameter to CanonicalView::balance
志宇 [Thu, 11 Sep 2025 03:48:27 +0000 (03:48 +0000)]
feat(chain): Add min_confirmations parameter to CanonicalView::balance

Add min_confirmations parameter to control confirmation depth requirements:
- min_confirmations = 0: Include all confirmed transactions (same as 1)
- min_confirmations = 1: Standard behavior - require at least 1 confirmation
- min_confirmations = 6: High security - require at least 6 confirmations

Transactions with fewer than min_confirmations are treated as trusted/untrusted
pending based on the trust_predicate. This restores the minimum confirmation
functionality that was available in the old TxGraph::balance doctest but with
a more intuitive API since CanonicalView has the tip internally.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
3 months agofeat(chain)!: Introduce `CanonicalView` and migrate API
志宇 [Thu, 11 Sep 2025 03:48:27 +0000 (03:48 +0000)]
feat(chain)!: Introduce `CanonicalView` and migrate API

- Add `CanonicalView` structure with canonical transaction methods
- Move methods from `TxGraph` to `CanonicalView` (txs, filter_outpoints, balance, etc.)
- Add canonical view methods to `IndexedTxGraph`
- Update all tests and examples to use new API
- Optimize examples to reuse canonical view instances

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
3 months agoMerge bitcoindevkit/bdk#2028: Add `last_evicted` field to `TxNode`
merge-script [Sun, 14 Sep 2025 23:20:01 +0000 (23:20 +0000)]
Merge bitcoindevkit/bdk#2028: Add `last_evicted` field to `TxNode`

3fb768bd416b6979f938aacfc9ed681a64d4549f feat(chain)!: Add `last_evicted` field to `TxNode` (志宇)

Pull request description:

  ### Description

  All `last_evicted` field to `TxNode` and remove `TxGraph::get_last_evicted` method.

  ### Notes to the reviewers

  `get_last_evicted` was added as adding fields to `TxNode` is a breaking change. However, we are going to break `bdk_chain` in the next release so a breaking change now is okay.

  ### Changelog notice

  ```md
  Added:
  - `last_evicted` field is added to `TxNode`.

  Removed:
  - `TxGraph::get_last_evicted` method is removed.
  ```

  ### Checklists

  #### All Submissions:

  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)

  #### New Features:

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

ACKs for top commit:
  oleonardolima:
    ACK 3fb768bd416b6979f938aacfc9ed681a64d4549f
  LagginTimes:
    ACK 3fb768bd416b6979f938aacfc9ed681a64d4549f

Tree-SHA512: 7dc5f68d8a49f10dc16e5ff5b00a02ee991eea832cd7ac96d454b5fb44067c868338921f428d8fdaad38e491c4f8f25baa119dc6de85b1e6c22cab36d95cb423

3 months agoMerge bitcoindevkit/bdk#1582: refactor!: Implement generics for `CheckPoint`, `LocalC...
merge-script [Sun, 14 Sep 2025 23:20:01 +0000 (23:20 +0000)]
Merge bitcoindevkit/bdk#1582: refactor!: Implement generics for `CheckPoint`, `LocalChain`, and `spk_client` types

8bc239168a2d81430244ee7633723f7eefe0d0f4 docs(chain): update docs for `CheckPoint` and `SyncRequest` (Wei Chen)
7cf4e5b9b3843ae1fce109de611edb0923db63c6 test(chain): Add test for inserting `Header` into `LocalChain` (Wei Chen)
93a382df07a4d2ccafc13164d0b98abd2ae03119 refactor!: make `CheckPoint`, `LocalChain`, and `SpkClient` take a generic (Wei Chen)

Pull request description:

  Implements bitcoindevkit/bdk#1937.

  ### Description

  This PR is a step towards header checkpointing for `bdk_electrum`. The goal is to be able to store whole headers in `CheckPoint` so they do not have to be re-downloaded. Storing headers this way would be a prerequisite for caching of merkle proofs and for median time passed.

  ### Notes to the reviewers

  ### Changelog notice

  * `CheckPoint` takes in a generic.
  * `LocalChain` and `ChangeSet` take in generics.
  * `spk_client` types can take in generics.

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

Tree-SHA512: 3c11b559a8d8f7cdf0418dbece7821e3304acd6b6e96b3e1827cdfc30b4a268c9d3511a9bc3d11408198ac93a96a84e449b879f562f368dc44a945671ef98e39

3 months agodocs(chain): update docs for `CheckPoint` and `SyncRequest`
Wei Chen [Mon, 18 Aug 2025 06:57:53 +0000 (06:57 +0000)]
docs(chain): update docs for `CheckPoint` and `SyncRequest`

3 months agotest(chain): Add test for inserting `Header` into `LocalChain`
Wei Chen [Tue, 10 Sep 2024 15:36:34 +0000 (23:36 +0800)]
test(chain): Add test for inserting `Header` into `LocalChain`

3 months agorefactor!: make `CheckPoint`, `LocalChain`, and `SpkClient` take a generic
Wei Chen [Sat, 31 Aug 2024 11:06:44 +0000 (19:06 +0800)]
refactor!: make `CheckPoint`, `LocalChain`, and `SpkClient` take a generic

3 months agoMerge bitcoindevkit/bdk#2023: chore(release): bump `bdk-chain` to `0.23.2` github/release/chain-0.23.2 bitcoind_rpc-0.22.0 chain-0.23.2 core-0.6.2 electrum-0.23.2 file_store-0.22.0
merge-script [Fri, 12 Sep 2025 00:53:06 +0000 (10:53 +1000)]
Merge bitcoindevkit/bdk#2023: chore(release): bump `bdk-chain` to `0.23.2`

d0c691fdbbfc9cf1ec493dfad8e67a2e1d51a617 chore(release): bump `bdk-chain` to `0.23.2` (Leonardo Lima)

Pull request description:

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

  ### Description

  It bumps the required versions for the next releases and also each CHANGELOG.md

  - bump `bdk_core` to `0.6.2`
  - bump `bitcoind_rpc` to `0.22.0`
  - bump `file_store` to `0.22.0`.
  - bump `bdk_electrum` to `0.23.2`

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

  ### Checklists

  #### All Submissions:

  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)

ACKs for top commit:
  ValuedMammal:
    ACK d0c691fdbbfc9cf1ec493dfad8e67a2e1d51a617
  LagginTimes:
    ACK d0c691fdbbfc9cf1ec493dfad8e67a2e1d51a617
  notmandatory:
    ACK d0c691fdbbfc9cf1ec493dfad8e67a2e1d51a617
  evanlinjin:
    ACK d0c691fdbbfc9cf1ec493dfad8e67a2e1d51a617

Tree-SHA512: e1332984801ffe011ffbaa0e4c41bf1f992651081b5518422a544f8b7a98a8cbd22a2900ec4e0199a6501b2c0f5e909272eaa08618abaa91eb4e505e32676c02

3 months agofeat(chain)!: Add `last_evicted` field to `TxNode`
志宇 [Wed, 10 Sep 2025 07:50:56 +0000 (07:50 +0000)]
feat(chain)!: Add `last_evicted` field to `TxNode`

Also remove `TxGraph::get_last_evicted` method.

3 months agochore(release): bump `bdk-chain` to `0.23.2`
Leonardo Lima [Wed, 10 Sep 2025 01:23:32 +0000 (11:23 +1000)]
chore(release): bump `bdk-chain` to `0.23.2`

- bump `bdk_core` to `0.6.2`
- bump `bitcoind_rpc` to `0.22.0`
- bump `file_store` to `0.22.0`.
- bump `bdk_electrum` to `0.23.2`
- update all the required `CHANGELOG.md`

3 months agoMerge bitcoindevkit/bdk#2000: `FilterIter` API redesign
merge-script [Tue, 9 Sep 2025 00:24:56 +0000 (00:24 +0000)]
Merge bitcoindevkit/bdk#2000: `FilterIter` API redesign

6aa81fe2ff5737add0be0664347a786573060706 test(bitcoind): Test 6-block reorg to `filter_iter_detects_reorgs` test (志宇)
4b295eec7728fec008a9d83f3d56c28109bdfb8e docs(bip158): Update `FilterIter` documentation (valued mammal)
2181c4babf94e541ca695103619ef8eecfb731d2 feat(rpc)!: `FilterIter` API redesign (valued mammal)

Pull request description:

  Previously `FilterIter` did not detect or handle reorgs between `next` calls, meaning that if a reorg occurred, we might process blocks from a stale fork potentially resulting in an invalid wallet state. This PR aims to fix that by adding logic to explicitly check for and respond to a reorg on every call to `next`.

  ### Notes to the reviewers

  The old implementation required storing block IDs of scanned blocks before creating a checkpoint update, but because the interface was split across different methods, it introduced a timing risk between method calls which, when we consider the possibility of reorgs, made the implementation somewhat brittle.

  To address this, we make sure that 1) Finding the start block and 2) Updating the internal checkpoint are directly tied to the logic of `next`. Since the checkpoint in practice is derived from a clone of the local chain, this ensures that the checkpoint returned by `next` can always find a connection point with the receiver. Additionally we now emit a checkpoint at every height to ensure that any "must-include" heights are not missing.

  For example usage see `examples/filter_iter.rs`

  fixes #1848

  ### Changelog notice

      Fixed
      - `FilterIter` now handles reorgs to ensure consistency of the header chain.

      Changed
      - `Event` is now a struct instead of enum

      Added
      - `FilterIter::new` constructor that takes as input a reference to the RPC client, checkpoint, and a list of SPKs.
      - `Error::ReorgDepthExceeded` variant
      - `Error::TryFromInt` variant

      Removed
      - `FilterIter::new_with_height`
      - `FilterIter::new_with_checkpoint`
      - `EventInner` type
      - `FilterIter::get_tip`
      - `FilterIter::chain_update`
      - `Error::NoScripts` variant

  ### Checklists

  #### All Submissions:

  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)

  #### 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:
  ValuedMammal:
    ACK 6aa81fe2ff5737add0be0664347a786573060706
  evanlinjin:
    ACK 6aa81fe2ff5737add0be0664347a786573060706
  oleonardolima:
    tACK 6aa81fe2ff5737add0be0664347a786573060706
  LagginTimes:
    ACK 6aa81fe2ff5737add0be0664347a786573060706

Tree-SHA512: 4aebec0184f9cb0ba601811409cf782ab3ad1536bb2dd1f177b2263df5fe99739a675734aa00b28af1dd1bce77071ac18ac7f2c3e849cbd876a3639981af390a

3 months agoMerge bitcoindevkit/bdk#2007: docs(chain): add doctest for min confirmation balance...
merge-script [Mon, 8 Sep 2025 07:12:35 +0000 (17:12 +1000)]
Merge bitcoindevkit/bdk#2007: docs(chain): add doctest for min confirmation balance filtering

657a044370a102259eb1b7f5abdfee2dde998bc2 docs(chain): add doctest for min confirmation balance filtering (Wei Chen)

Pull request description:

  Implements #1942.

  ### Description

  This PR adds a new doctest demonstrating how to simulate a minimum confirmation threshold for confirmed balance calculations by adjusting the `chain_tip` height passed to `TxGraph::balance`.

  ### Changelog notice

  - Added a doctest illustrating how to filter confirmed balance results by simulating a minimum confirmation threshold via `chain_tip` height.

  ### Checklists

  #### All Submissions:

  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)

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

ACKs for top commit:
  oleonardolima:
    ACK 657a044370a102259eb1b7f5abdfee2dde998bc2
  evanlinjin:
    ACK 657a044370a102259eb1b7f5abdfee2dde998bc2

Tree-SHA512: 1c9514ee6cbf92df196b8e9295c81938cac4b822a7bc9703e93fabf79afaffd93d9d262bfdb74856774f1603d75b07a26cbfaefacc5a1336c8b214951458e2e1

3 months agotest(bitcoind): Test 6-block reorg to `filter_iter_detects_reorgs` test
志宇 [Mon, 8 Sep 2025 00:36:25 +0000 (00:36 +0000)]
test(bitcoind): Test 6-block reorg to `filter_iter_detects_reorgs` test

3 months agodocs(chain): add doctest for min confirmation balance filtering
Wei Chen [Thu, 7 Aug 2025 05:50:27 +0000 (05:50 +0000)]
docs(chain): add doctest for min confirmation balance filtering

3 months agodocs(bip158): Update `FilterIter` documentation
valued mammal [Mon, 1 Sep 2025 15:23:13 +0000 (11:23 -0400)]
docs(bip158): Update `FilterIter` documentation

3 months agofeat(rpc)!: `FilterIter` API redesign
valued mammal [Thu, 24 Jul 2025 18:16:31 +0000 (14:16 -0400)]
feat(rpc)!: `FilterIter` API redesign

The API now consists of the methods `new` and `next`.

The local checkpoint and SPK inventory are provided to
the constructor. `next` is now responsible for locating
the point of agreement.

The next filter to fetch is determined by the `next_block_hash`
field of `GetBlockHeaderResult`. If the next header has negative
confirmations due to a reorg, we rewind the internal state until
we find a header still in the best chain.

`Event` is changed to a simple struct containing `cp` and optional
`block`. The checkpoint is updated on each iteration whether
or not it corresponds to a matching block. We use
`CheckPoint::insert` which will also purge evicted blocks
if needed.

Change implementation of `find_base` to use `get_block_header_info`
which helps to reduce the number of RPC calls.

Removed `EventInner`.

Add test `event_checkpoint_connects_to_local_chain` to check
the expected events after a reorg, and check that intermediate
updates can be applied to the local chain.

Co-authored-by: Musab1258 <habeebmusab@gmail.com>
Co-authored-by: Wei Chen <wzc110@gmail.com>
Co-authored-by: 志宇 <hello@evanlinjin.me>
3 months agoMerge bitcoindevkit/bdk#2019: ci: pin `time` for msrv
merge-script [Mon, 1 Sep 2025 16:10:07 +0000 (12:10 -0400)]
Merge bitcoindevkit/bdk#2019: ci: pin `time` for msrv

09b42d0d89d584c85a1ed46572ef2a9a3a0794e7 ci: pin `time` for msrv (Wei Chen)

Pull request description:

  ### Description

  Pin `time` to `0.3.41` for 1.75 MSRV.

  ### Changelog notice

  * Pin `time` to `0.3.41` for 1.75 MSRV.

  ### Checklists

  #### All Submissions:

  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)

ACKs for top commit:
  ValuedMammal:
    ACK 09b42d0d89d584c85a1ed46572ef2a9a3a0794e7

Tree-SHA512: cca9ffaba8903372652fa4e251b1838d7ff05e0e9f5b3f24b06aeb1c64773fc56212259d49060521c0220f6f48a64a3775e9b2f6c24da7e9292fd9d6bba65875

3 months agoci: pin `time` for msrv
Wei Chen [Mon, 1 Sep 2025 07:32:42 +0000 (07:32 +0000)]
ci: pin `time` for msrv

3 months agoMerge bitcoindevkit/bdk#2011: fix(electrum): fix stale anchor hash on reorg
merge-script [Fri, 29 Aug 2025 00:11:09 +0000 (00:11 +0000)]
Merge bitcoindevkit/bdk#2011: fix(electrum): fix stale anchor hash on reorg

fdec863ed134f2b94186a3c5d462a5d1e65956ab fix(electrum): fix stale anchor hash on reorg (Wei Chen)

Pull request description:

  ### Description

  Fixes an issue in `batch_fetch_anchors()` in `bdk_electrum` where, if a stale block header was detected and a fresh header was fetched, the confirmation anchor inserted into `anchor_cache` still used the hash from the original stale header instead of the new one.

  ### Changelog notice

  - `batch_fetch_anchors()` no longer uses a potentially stale hash as the anchor.

  ### Checklists

  #### All Submissions:

  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)

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

Tree-SHA512: be098569d8e038ca65b9c572f92642151679e36ed4138ca89d554c31bd97aaabfcb430ee055939cc37fcccb35a45bb6158a9b303241a6cf410caf7657d33a5f5

3 months agofix(electrum): fix stale anchor hash on reorg
Wei Chen [Tue, 12 Aug 2025 08:15:00 +0000 (08:15 +0000)]
fix(electrum): fix stale anchor hash on reorg

3 months agoMerge bitcoindevkit/bdk#2005: Add populate_anchor_cache method to bdk
merge-script [Fri, 29 Aug 2025 00:11:09 +0000 (00:11 +0000)]
Merge bitcoindevkit/bdk#2005: Add populate_anchor_cache method to bdk

191bdb154e99de616c2409fbfcab3ef5e2257262 feat(electrum): Add `populate_anchor_cache` method (+Sharon)

Pull request description:

  This PR addresses #1982
  It introduces functionality to populate the anchor cache, improving how BDK handles stateful or performance-critical anchor data.

  ### Changes
  - Add `populate_anchor_cache` method to `BdkElectrumClient `in `bdk-core`
  - Improves sync speed by caching anchor transactions in advance
  - Enables pre-caching of anchor transactions to reduce redundant network calls

  Follow-up work will extend this functionality to `bdk-wallet`.

ACKs for top commit:
  evanlinjin:
    ACK 191bdb154e99de616c2409fbfcab3ef5e2257262

Tree-SHA512: b14e9ee5a5deb439951175195419c2e07e513c23a6c242254e610b1f6d38a37cb71f2ae8d82f9c34628acf665126256eab7f37bf9ba6634547e7218433136cbe

3 months agofeat(electrum): Add `populate_anchor_cache` method
+Sharon [Fri, 1 Aug 2025 00:59:10 +0000 (03:59 +0300)]
feat(electrum): Add `populate_anchor_cache` method

Also updates the `example_electrum` example and `populate_tx_cache`
documentation to be consistent with `populate_anchor_cache`.

3 months agoMerge bitcoindevkit/bdk#2018: ci: pin `socket2` for msrv
merge-script [Fri, 29 Aug 2025 00:11:09 +0000 (00:11 +0000)]
Merge bitcoindevkit/bdk#2018: ci: pin `socket2` for msrv

520b116c0d0cafd03522b50dd9f0469cb6d34d6d ci: pin `socket2` for msrv (Wei Chen)

Pull request description:

  ### Description

  Pin `socket2@0.6.0` to `0.5.10` for MSRV.

  ### Changelog notice

  * Pin `socket2@0.6.0` to `0.5.10` for MSRV.

  ### Checklists

  #### All Submissions:

  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)

ACKs for top commit:
  evanlinjin:
    ACK 520b116c0d0cafd03522b50dd9f0469cb6d34d6d

Tree-SHA512: ef3f4519795c166b3c464dc6d9273526a9516ddd2a0810eff3a4ddffd0ad1fd51dbe722a600cab1ce6822b222284cda981d4ca3fe1e815be957e4d34149154b1

3 months agoci: pin `socket2` for msrv
Wei Chen [Thu, 28 Aug 2025 16:39:07 +0000 (16:39 +0000)]
ci: pin `socket2` for msrv

3 months agoMerge bitcoindevkit/bdk#1992: chore: add metadata fields to issue templates for triage
merge-script [Fri, 22 Aug 2025 18:57:47 +0000 (15:57 -0300)]
Merge bitcoindevkit/bdk#1992: chore: add metadata fields to issue templates for triage

0eb852c75fcd72f5a919d21ab9645717319dfd97 chore: add metadata fields to issue templates for triage (Wei Chen)

Pull request description:

  ### Description

  This PR updates the GitHub issue templates `bug_report.md` and `enhancement_request.md` to improve triage and prioritization. Specifically, it adds structured fields for:

  * Production impact (e.g., blocking usage vs. nice-to-have)
  * Backend in use (Electrum, Esplora, RPC, etc.)
  * Project or organization (optional, helps identify high-priority users)

  The goal is to make it easier for maintainers to gauge the urgency and relevance of issues, especially for production users or high-impact integrations.

  ### Checklists

  #### All Submissions:

  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)

ACKs for top commit:
  evanlinjin:
    ACK 0eb852c75fcd72f5a919d21ab9645717319dfd97
  oleonardolima:
    ACK 0eb852c75fcd72f5a919d21ab9645717319dfd97

Tree-SHA512: 2b77a42a9cb79c2100c4fa22548990bad0413e573e7e7af86b4335bf752e3ffc0bf56ebcbb377aa599219a0c15baafcd7a61ede422bcaa56459f5bab8eb20a6b

4 months agochore: add metadata fields to issue templates for triage
Wei Chen [Mon, 14 Jul 2025 08:34:52 +0000 (08:34 +0000)]
chore: add metadata fields to issue templates for triage

4 months agoMerge bitcoindevkit/bdk#2013: ci: pin `rayon` dependencies for msrv
merge-script [Fri, 15 Aug 2025 02:29:56 +0000 (02:29 +0000)]
Merge bitcoindevkit/bdk#2013: ci: pin `rayon` dependencies for msrv

763b29e1d27049d52b742c2fcff9180b46863105 ci: pin `rayon` dependencies for msrv (Wei Chen)

Pull request description:

  ### Description

  Pinned `rayon = 1.10.0` and `rayon-core = 1.12.1` for 1.63 and 1.75 MSRV.

  ### Changelog notice

  - Pin `rayon 1.10.0` and `rayon-core 1.12.1` for MSRV.

  ### Checklists

  #### All Submissions:

  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)

ACKs for top commit:
  ValuedMammal:
    utACK 763b29e1d27049d52b742c2fcff9180b46863105
  evanlinjin:
    ACK 763b29e1d27049d52b742c2fcff9180b46863105

Tree-SHA512: 2de7ebad9889e1ff89d13051d872ea72acb8c684c5397833c263643dcdb440d24727f2477d705450ea2b034dc371f9f925004f90745de5f52b58371479b9be39

4 months agoci: pin `rayon` dependencies for msrv
Wei Chen [Wed, 13 Aug 2025 07:55:16 +0000 (07:55 +0000)]
ci: pin `rayon` dependencies for msrv

4 months agoMerge bitcoindevkit/bdk#2008: `IndexedTxGraph`: Transactions that conflict with relev...
merge-script [Sun, 10 Aug 2025 09:45:12 +0000 (09:45 +0000)]
Merge bitcoindevkit/bdk#2008: `IndexedTxGraph`: Transactions that conflict with relevant txs are also relevant.

7ca58b3f6b81f22dff97e74e3e44b4e037f401e1 chore(chain): fix typo in method doc comment (Wei Chen)
c846ad84dda49d2c76e44786f59eb20e02b7710f test(chain): `relevant_conflicts` (志宇)
7003ad44be288cda0ce447e3fa99f893ce48332e feat(chain): Txs that conflict with relevant txs are also relevant (志宇)

Pull request description:

  ## Description

  This PR changes the behavior of `IndexedTxGraph` insert-if-relevant methods to consider relevant-tx-conflicts as relevant.

  Affected methods:
  * `.apply_block_relevant`
  * `.batch_insert_relevant`
  * `.batch_insert_relevant_unconfirmed`

  #### Rationale

  It is useful to be able to determine:

  * Why something is no longer part of the best history.
  * Whether it is possible that something can reappear in the best history.

  In order to do this, we need to track conflicts of spk-relevant transactions.

  For example, an incoming transaction may be evicted from the mempool due to insufficient fees or cancelled (a conflicting transaction is confirmed). The caller may want to handle these two possibilities differently:

  * **Transaction has insufficient fees** - the caller may want to CPFP the transaction.
  * **Transaction is cancelled/replaced** - The user may want to forget about this transaction once the conflict reaches x confirmations.

  The `IntentTracker` will make use of these relevant-conflicts to help determine the course of action.

  #### Side note about chain sources

  For some chain sources, obtaining relevant-conflicts is extremely costly or downright impossible (i.e. Electrum, BIP-158 filters).

  `bdk_bitcoind_rpc::Emitter` is still the most robust chain source to use.

  ### Changelog notice

  ```md
  Changed:
  - Behavior of `IndexedTxGraph` methods (`apply_block_relevant`, `batch_insert_relevant` and `batch_insert_relevant_unconfirmed`) to also consider conflicts of spk-relevant transactions as relevant.
  ```

  ### Checklists

  #### All Submissions:

  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)

  #### New Features:

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

ACKs for top commit:
  LagginTimes:
    ACK 7ca58b3f6b81f22dff97e74e3e44b4e037f401e1
  nymius:
    ACK 7ca58b3f6b81f22dff97e74e3e44b4e037f401e1

Tree-SHA512: c5e8d45681ad149d9c963c11b8db7787d03ac1f17aa9cdaca7e1044537127c35bfdb3f6f56169a7a35f64bc9cc7d5a9867a01cdb2f2db8613b1d41ed62917e3b

4 months agochore(chain): fix typo in method doc comment
Wei Chen [Thu, 7 Aug 2025 06:36:45 +0000 (06:36 +0000)]
chore(chain): fix typo in method doc comment

4 months agoMerge bitcoindevkit/bdk#1998: refactor!: `Box` the changeset of `StoreErrorWithDump`
merge-script [Thu, 7 Aug 2025 02:54:37 +0000 (02:54 +0000)]
Merge bitcoindevkit/bdk#1998: refactor!: `Box` the changeset of `StoreErrorWithDump`

418753f01eef29b1266cc3aefa512f90060a9797 refactor!: `Box` changeset in `StoreErrorWithDump` (codingp110)

Pull request description:

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

  ### Description
  Fixes #1991. As the linked issue mentions `Box`ing helps reduce memory overhead and [limits the size of enums with `StoreErrorWithDump` as variant](https://github.com/bitcoindevkit/bdk_wallet/pull/277#discussion_r2196831262).

  Breaking: The enum `StoreErrorWithDump` and the functions `load`,`dump` and `load_or_create` have been changed.

  ### Changelog Notice
  ```
     Changed
     - `changeset` field of `StoreErrorWithDump` is now of type `Option<Box<C>>`
  ```

  ### Checklists

  #### All Submissions:

  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)

ACKs for top commit:
  evanlinjin:
    ACK 418753f01eef29b1266cc3aefa512f90060a9797

Tree-SHA512: c09d2b14989f62613283b728cd8f0eec849a2f3980b07e4289d55289a2834b27c32ff0fcb89706c636441c02b385fbb4a4175e93615f6e16fa2e2e0cfb0e4e26

4 months agotest(chain): `relevant_conflicts`
志宇 [Sat, 2 Aug 2025 06:16:26 +0000 (06:16 +0000)]
test(chain): `relevant_conflicts`

4 months agoMerge bitcoindevkit/bdk#2004: chore(release): bump bdk-chain to `0.23.1` and update... bitcoind_rpc-0.21.0 chain-0.23.1 core-0.6.1 electrum-0.23.1 esplora-0.22.1 file_store-0.21.1 testenv-0.13.1
merge-script [Tue, 5 Aug 2025 22:42:11 +0000 (19:42 -0300)]
Merge bitcoindevkit/bdk#2004: chore(release): bump bdk-chain to `0.23.1` and update `CHANGELOG`s

e69023c03a9f9071c1da3b120b251161caee8516 chore(bdk-chain): bump to `0.23.1`, update `CHANGELOG` (Leonardo Lima)

Pull request description:

  fixes #2003

  ### Description

  It updates the crates CHANGELOGs, and bumps its newer versions.

  ### Notes to the reviewers

  Let me know if you think I missed anything on the CHANGELOG's or the bumped versions are off.

  ### Changelog notice

  - bump `bdk-chain` to `0.23.1 and other crates too.
  - update all required CHANGELOGs

  ### Checklists

  #### All Submissions:

  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)

ACKs for top commit:
  ValuedMammal:
    reACK e69023c03a9f9071c1da3b120b251161caee8516

Tree-SHA512: ddcae7cd46bfe418d58793420eb69f1609878e2e01c0c900532642c7b2d32fbb921518620593bf57c7effbe3600896e90cf6abbcd36f7b1ca9b49502b587e02d

4 months agochore(bdk-chain): bump to `0.23.1`, update `CHANGELOG`
Leonardo Lima [Thu, 31 Jul 2025 14:51:34 +0000 (11:51 -0300)]
chore(bdk-chain): bump to `0.23.1`, update `CHANGELOG`

chore(bdk-core): bump to `bdk-core` `0.6.1` and update `CHANGELOG`

chore(bdk-testenv): bump to `bdk-testenv` `0.13.1` and update `CHANGELOG`

chore(bdk-filestore): bump to `0.21.1` and update `CHANGELOG`

chore(bitcoind-rpc): bump to `0.21.0` and update `CHANGELOG`

chore(bdk-electrum): bump to `0.23.1` and update `CHANGELOG`

chore(bdk-esplora): bump to `0.22.1` and update `CHANGELOG`

4 months agorefactor!: `Box` changeset in `StoreErrorWithDump`
codingp110 [Mon, 21 Jul 2025 16:27:06 +0000 (21:57 +0530)]
refactor!: `Box` changeset in `StoreErrorWithDump`

As mentioned in the corresponding issue, `Box`ing helps reduce memory
overhead while passing the enum around and also to limit the size of
enums with `StoreErrorWithDump` as a variant.

Breaking: The enum `StoreErrorWithDump` has been changed.

4 months agoMerge bitcoindevkit/bdk#1989: chore(bdk-electrum): use new `batch_transaction_get_mer...
merge-script [Mon, 4 Aug 2025 16:11:13 +0000 (13:11 -0300)]
Merge bitcoindevkit/bdk#1989: chore(bdk-electrum): use new `batch_transaction_get_merkle` API

b663940ac3c81f57589f13bcc49dc1f8b483dc74 chore(bdk-electrum): use new `batch_transaction_get_merkle` API (Leonardo Lima)

Pull request description:

  fixes #1987
  depends on https://github.com/bitcoindevkit/rust-electrum-client/pull/170

  ### Description

  - update `batch_fetch_anchors` to use `batch_transaction_get_merkle` method instead of manually creating the batch call.

  ### Changelog notice

  ```md
  ### Changes
  - Use new `batch_transaction_get_merkle` method instead of batch raw calls
  ```

  ### 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 +nightly fmt` and `cargo clippy` before committing

ACKs for top commit:
  ValuedMammal:
    ACK b663940ac3c81f57589f13bcc49dc1f8b483dc74
  LagginTimes:
    ACK b663940ac3c81f57589f13bcc49dc1f8b483dc74

Tree-SHA512: 8c08bcaf99bb65098015995eae67c710fbe2f8e76d47796aebbfba1c5a1c78174023be3cb21299e4c820d156110742c9e85819c253dcf9bc3e1fa1621ca35378

4 months agochore(bdk-electrum): use new `batch_transaction_get_merkle` API
Leonardo Lima [Fri, 4 Jul 2025 18:46:03 +0000 (15:46 -0300)]
chore(bdk-electrum): use new `batch_transaction_get_merkle` API

- removes the now unused `serde_json` dependency from `bdk_electrum`.
- update `batch_fetch_anchors` to use `batch_transaction_get_merkle`
  method instead of manually creating the batch call.

4 months agofeat(chain): Txs that conflict with relevant txs are also relevant
志宇 [Sat, 2 Aug 2025 06:16:26 +0000 (06:16 +0000)]
feat(chain): Txs that conflict with relevant txs are also relevant

Change behavior of {insert|apply}-if-relevant methods of `IndexedTxGraph`
to also consider txs that conflict with relevant txs as relevant.

Rationale:

It is useful to determine why something is evicted from the mempool.

For example, an incoming transaction may be evicted from the mempool due
to insufficient fees or a conflicting transaction is confirmed.

* Insufficient fees - the user may want to CPFP the tx.
* Conflicting tx is confirmed - the sender probably purposefully
  cancelled the tx. The user may want to forget about this tx once it
  reaches x confirmations.

The `IntentTracker` will make use of these relevant-conflicts.

A note about chain sources:

For some chain sources, obtaining relevant-conflicts is extremely
costly or downright impossible (i.e. Electrum, BIP-158 filters).

`bdk_bitcoind_rpc::Emitter` is still the most robust chain source to use.

4 months agoMerge bitcoindevkit/bdk#1994: ci: automated update to rustc 1.88.0
merge-script [Fri, 1 Aug 2025 16:27:27 +0000 (12:27 -0400)]
Merge bitcoindevkit/bdk#1994: ci: automated update to rustc 1.88.0

cedf9e1a01bcb6703cd543a8a791d4db4f688c82 ci: automated update to rustc 1.88.0 (Github Action)

Pull request description:

  Automated update to Github CI workflow `cont_integration.yml` by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action

ACKs for top commit:
  ValuedMammal:
    ACK cedf9e1a01bcb6703cd543a8a791d4db4f688c82

Tree-SHA512: 8b310912b41ec3171681c8a62f180e61e54929776e82b6221debecdd04b36c03aca5c1d83fc6261fed21807a71284cb47ed8c0ca2b7290428242c9fb618e1ed2

4 months agoMerge bitcoindevkit/bdk#1986: ci: replace grcov by cargo-llvm-cov
merge-script [Tue, 29 Jul 2025 23:51:06 +0000 (19:51 -0400)]
Merge bitcoindevkit/bdk#1986: ci: replace grcov by cargo-llvm-cov

066c4cd160f6d4c70409b299a173f31f93728fae ci: replace grcov by cargo-llvm-cov (nymius)

Pull request description:

  ### Description

  As explained in #1984 , I discovered some misreportings in the coverage information given by grcov.

  Fixes #1984

  ### Notes to the reviewers

  The discussion about the tool to use is open, but I'm adding this PR to showcase how a change from `grcov` to `cargo-llvm-cov` would look like and the improvements in reporting this change will bring. [Look the report in `coveralls`](https://coveralls.io/github/nymius/bdk?branch=ci/replace-grcov-by-cargo-llvm-cov) to get a better perspective of them.

  ### 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 +nightly fmt` and `cargo clippy` before committing

ACKs for top commit:
  ValuedMammal:
    ACK 066c4cd160f6d4c70409b299a173f31f93728fae
  oleonardolima:
    ACK 066c4cd160f6d4c70409b299a173f31f93728fae

Tree-SHA512: d237fcc36efb6a4d3ccfaa371c2c70fc18ee40b48ca48f1230c5df6dca093f57bc1096927ddb15f9cae59a4640d9e34bf3ef1a309037e21fe0e8348e132bf38d

4 months agoMerge bitcoindevkit/bdk#2001: ci: fix `socket2` pin
merge-script [Tue, 29 Jul 2025 18:52:52 +0000 (15:52 -0300)]
Merge bitcoindevkit/bdk#2001: ci: fix `socket2` pin

5ebbac83ee2dcf50011976d55e0446d9f23780f8 ci: fix `socket2` pin (Wei Chen)

Pull request description:

  ### Description

  Fix `socket2` pin that was causing CI issues.

  ### Changelog notice

  * Unpinned `socket2` dependency that was causing CI issues.

  ### Checklists

  #### All Submissions:

  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)

ACKs for top commit:
  oleonardolima:
    ACK 5ebbac83ee2dcf50011976d55e0446d9f23780f8
  notmandatory:
    ACK 5ebbac83ee2dcf50011976d55e0446d9f23780f8

Tree-SHA512: f5b59fb0f8489f136f4e817de72a728a785e4e4803624143f90d35a70cba9cc4b0185c1fa3fcc42132cccd7bc4b80d7b7d8469e1c172b68e790dfe1af253ac7b

4 months agoci: fix `socket2` pin
Wei Chen [Tue, 29 Jul 2025 10:29:48 +0000 (10:29 +0000)]
ci: fix `socket2` pin

4 months agoMerge bitcoindevkit/bdk#1988: Detect new mempool txs
merge-script [Sat, 26 Jul 2025 10:47:05 +0000 (10:47 +0000)]
Merge bitcoindevkit/bdk#1988: Detect new mempool txs

51ee99a39fbf9a6dc0ead964e794ca3bebd43ed0 docs(bitcoind_rpc): fixed typo in docs (Wei Chen)
73ab1eb06bcfaa0368a07b84a054bdd2f4f84f06 chore(bitcoind_rpc): Make clippy happy (志宇)
7e894f464ffc0fc21a05e485eae574292e8a63d5 feat(bitcoind_rpc)!: Use `getrawmempool` without verbose (志宇)
05464ecf850feabd30a13aa4927d8797d06148cf fix(bitcoind_rpc)!: Simplify emitter (志宇)
67dfb0b1482f81fe5a888e94c8f54dc5be99e409 test(bitcoind_rpc): Detect new mempool txs (志宇)

Pull request description:

  ### Description

  There is a bug in `bdk_bitcoind_rpc` where some new mempool transactions will not be emitted at all.

  This problem exists because the avoid-re-emission logic depends on rounded-to-nearest-second timestamps.

  The fix is to just emit all mempool transactions but wrap them in `Arc`s so that emission becomes cheap.

  **Background:** I tried using `bdk_bitcoind_rpc` as the chain-source to write an example to showcase the [`IntentTracker`](https://github.com/bitcoindevkit/bdk_wallet/pull/257). However, `bdk_bitcoind_rpc` failed to emit some mempool transactions.

  ### Notes to the reviewers

  The test added in c22c68f fails without these fixes.

  Some tests are removed as they are no longer relevant.

  ### Changelog notice

  ```md
  Fixed:
  - Some mempool transactions not being emitted at all. The fix is to replace the avoid-re-emission-logic with one which emits all mempool 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 +nightly fmt` and `cargo clippy` before committing

  #### Bugfixes:

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

ACKs for top commit:
  nymius:
    cACK 51ee99a39fbf9a6dc0ead964e794ca3bebd43ed0
  LagginTimes:
    Re-ACK 51ee99a39fbf9a6dc0ead964e794ca3bebd43ed0

Tree-SHA512: 04e180e1d28c3f4c581a61ccac95e8e7e6927123d272ed07eae0ae51bf70799df44298b47ba0e49a309fd76366875e8d18d73478252931713137844857b8ed5a

4 months agoMerge bitcoindevkit/bdk#1999: fix(ci): pin `socket2@0.6.0` to `0.5.10` on MSRV
merge-script [Fri, 25 Jul 2025 23:03:51 +0000 (20:03 -0300)]
Merge bitcoindevkit/bdk#1999: fix(ci): pin `socket2@0.6.0` to `0.5.10` on MSRV

87399b117abf5130da236e47181d64a611138bf3 fix(ci): pin `socket2@0.6.0` to `0.5.10` (Leonardo Lima)

Pull request description:

  ### Description

  It pins the `socket2@0.6.0` to `0.5.10` in order to fix the MSRV CI step.

  ### Changelog notice

  - Update the `ci/pin-msrv.sh` to also pin `socket2@0.6.0` to `0.5.10` version.

  ### Checklists

  #### All Submissions:

  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)

ACKs for top commit:
  ValuedMammal:
    ACK 87399b117abf5130da236e47181d64a611138bf3
  LagginTimes:
    ACK 87399b117abf5130da236e47181d64a611138bf3

Tree-SHA512: 739345cdc7c6f51b77f9a6bcb9b8abafcb5bbec3142674f94eaa5394e9a83643de27cbc62e7962790352be17f7c4cc3812844054c7d01b129aace1bb100b3b97

4 months agofix(ci): pin `socket2@0.6.0` to `0.5.10`
Leonardo Lima [Thu, 24 Jul 2025 18:49:48 +0000 (15:49 -0300)]
fix(ci): pin `socket2@0.6.0` to `0.5.10`

4 months agodocs(bitcoind_rpc): fixed typo in docs
Wei Chen [Mon, 21 Jul 2025 07:27:22 +0000 (07:27 +0000)]
docs(bitcoind_rpc): fixed typo in docs

5 months agoMerge bitcoindevkit/bdk#1996: ci: pin `webpki-roots` for MSRV compatibility
merge-script [Sat, 19 Jul 2025 07:46:12 +0000 (07:46 +0000)]
Merge bitcoindevkit/bdk#1996: ci: pin `webpki-roots` for MSRV compatibility

e1c8891e599d0d3215ba4d86b61d49c083517c96 ci: pin `webpki-roots` for MSRV compatibility (Wei Chen)

Pull request description:

  ### Description

  This PR pins the `webpki-roots` crate to version 1.0.1 to maintain compatibility with our current MSRV.

  ### Changelog notice

  - Pin `webpki-roots` to 1.0.1 for MSRV compatibility.

  ### Checklists

  #### All Submissions:

  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)

ACKs for top commit:
  oleonardolima:
    ACK e1c8891e599d0d3215ba4d86b61d49c083517c96
  evanlinjin:
    ACK e1c8891e599d0d3215ba4d86b61d49c083517c96

Tree-SHA512: 9849cf47f6c269b100374d4c32591ea0caa70f40f0249ead6e5364862f939efff1dffb612d5760622c6389d38874c7c238f4774c019e483ce6dcd826939d653d

5 months agoci: pin `webpki-roots` for MSRV compatibility
Wei Chen [Fri, 18 Jul 2025 18:39:04 +0000 (18:39 +0000)]
ci: pin `webpki-roots` for MSRV compatibility

5 months agoMerge bitcoindevkit/bdk#1977: Add `TxGraph::get_last_evicted`
merge-script [Fri, 18 Jul 2025 11:15:10 +0000 (11:15 +0000)]
Merge bitcoindevkit/bdk#1977: Add `TxGraph::get_last_evicted`

b555acb91e30f7134ec2663477b015225140b11b feat(chain): Add `TxGraph::get_last_evicted` (志宇)

Pull request description:

  ### Description

  Ideally, this would be included as a field in `TxNode`, however that would be a breaking change.

  ### Changelog notice

  ```md
  Added
  - `TxGraph::get_last_evicted`
  ```

  ### 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 +nightly 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:
  evanlinjin:
    self-ACK b555acb91e30f7134ec2663477b015225140b11b

Tree-SHA512: f1661d204e89e400b93e17f51f890a591edcdeea95803c4c48b937b700f48d5f2d975fcf33def3c5e36df13809ac2cc75f99ffc99716fa38c356b253a61eb5cb

5 months agoMerge bitcoindevkit/bdk#1981: refactor(electrum): remove `unwrap()`s and `expect()`s
merge-script [Fri, 18 Jul 2025 11:15:10 +0000 (11:15 +0000)]
Merge bitcoindevkit/bdk#1981: refactor(electrum): remove `unwrap()`s and `expect()`s

b24ae6d71815e268417034fda44f2d57325f6166 test(electrum): test sync with incorrect network (Wei Chen)
0fdbe9d170941218dddd396c7204bfb8de035d43 fix(electrum): Return error on incorrect network (志宇)
2b56f1a0487742d9a5a3043c8235c3ecca96a487 refactor(electrum): remove `unwrap()`s and `expect()`s (Wei Chen)

Pull request description:

  Partially resolves https://github.com/bitcoindevkit/bdk_wallet/issues/30.

  ### Description

  This PR eliminates all `unwrap()` and `expect()` calls from `bdk_electrum_client`, replacing them with proper error handling. Given that all public methods already return `Result`, we now propagate error messages instead of panicking.

  ### Changelog notice

  * Removed all `unwrap()`s and `expect()`s from `bdk_electrum_client.rs`.

  ### 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 +nightly fmt` and `cargo clippy` before committing

ACKs for top commit:
  evanlinjin:
    ACK b24ae6d71815e268417034fda44f2d57325f6166

Tree-SHA512: 33c08031fda35ecc12100202fe7cba2f107bc4537e7519e2ed4df9c1ea70f4a644f0fce0d92175af9745d0bf352c61094eee2ff353636ba8342691d12e3b47cc

5 months agofeat(chain): Add `TxGraph::get_last_evicted`
志宇 [Sat, 14 Jun 2025 03:15:48 +0000 (13:15 +1000)]
feat(chain): Add `TxGraph::get_last_evicted`

Ideally, this would be included as a field in `TxNode`, however that
would be a breaking change.

5 months agoMerge bitcoindevkit/bdk#1993: keychain_txout: `apply_changeset` restores spk cache...
merge-script [Thu, 17 Jul 2025 18:27:11 +0000 (14:27 -0400)]
Merge bitcoindevkit/bdk#1993: keychain_txout: `apply_changeset` restores spk cache before last revealed

6ddecc983ab3fb163303af4902bd10cf7e4a1fdf refactor(keychain_txout): `apply_changeset` restores spk cache before last revealed (valued mammal)

Pull request description:

  This patch improves readability and maintains logical consistency with the use of `spk_cache` throughout the `keychain_txout` module.

  While it might offer a performance benefit, the results are mostly comparable with the current benchmarks as far as I can tell. At least there's no indication that it would negatively impact performance.

  fixes #1975

  ### Changelog notice

  ### Checklists

  #### All Submissions:

  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)

ACKs for top commit:
  LagginTimes:
    ACK 6ddecc983ab3fb163303af4902bd10cf7e4a1fdf

Tree-SHA512: 4c11d049f94f332c88c63687d5147d25cc372d65b5f1d9d9c8784e1310e0f03e9aee479b684c255dbebb1510a7922331ad07cbcbdf47d534cf28ea8ee0e1be66

5 months agoci: automated update to rustc 1.88.0
Github Action [Tue, 15 Jul 2025 01:22:51 +0000 (01:22 +0000)]
ci: automated update to rustc 1.88.0

5 months agorefactor(keychain_txout): `apply_changeset` restores spk cache before last revealed
valued mammal [Sat, 12 Jul 2025 14:44:46 +0000 (10:44 -0400)]
refactor(keychain_txout): `apply_changeset` restores spk cache before last revealed

This change improves readability and maintains logical consistency with
the use of `spk_cache` throughout the `keychain_txout` module.

5 months agotest(electrum): test sync with incorrect network
Wei Chen [Sun, 13 Jul 2025 18:42:42 +0000 (18:42 +0000)]
test(electrum): test sync with incorrect network

5 months agofix(electrum): Return error on incorrect network
志宇 [Thu, 10 Jul 2025 03:04:24 +0000 (03:04 +0000)]
fix(electrum): Return error on incorrect network

5 months agorefactor(electrum): remove `unwrap()`s and `expect()`s
Wei Chen [Wed, 25 Jun 2025 22:01:53 +0000 (22:01 +0000)]
refactor(electrum): remove `unwrap()`s and `expect()`s

5 months agoci: replace grcov by cargo-llvm-cov
nymius [Wed, 2 Jul 2025 14:10:20 +0000 (11:10 -0300)]
ci: replace grcov by cargo-llvm-cov

5 months agoMerge bitcoindevkit/bdk#1976: Disallow unconfirmed coinbase
merge-script [Thu, 10 Jul 2025 03:04:24 +0000 (03:04 +0000)]
Merge bitcoindevkit/bdk#1976: Disallow unconfirmed coinbase

c84035e4d804943da7b3308411a1402b1ff6e2ad test(chain): Add scenario: coinbase tx must not become unconfirmed (志宇)
e8da007011c3c7e247c26a1c9984319229bb0afa fix(chain): Unconfirmed coinbase txs should never be canonical (志宇)

Pull request description:

  ### Description

  The logic in `CanonicalIter` includes transactions anchored to blocks outside the best chain, since they may still appear in the mempool.

  However, coinbase transactions can never be unconfirmed—a case the previous logic failed to exclude.

  ### Notes to the reviewers

  Sorry for my previous oversight on this.

  ### Changelog notice

  ```md
  Fixed:
  - During canonicalization, exclude coinbase transactions when considering txs that are anchored in stale blocks.
  ```

  ### 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 +nightly fmt` and `cargo clippy` before committing

  #### Bugfixes:

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

ACKs for top commit:
  evanlinjin:
    self-ACK c84035e4d804943da7b3308411a1402b1ff6e2ad

Tree-SHA512: 3aaff032ce390a7a8845c8704727daccab1afa2b0437f6706802f6ec37f7ffd79729407f1cba91b7e5045974a3a627c78a150242e2aaacb04a03b8f47528046b

5 months agoMerge bitcoindevkit/bdk#1990: How can we be happy if clippy is not?
merge-script [Thu, 10 Jul 2025 03:04:24 +0000 (03:04 +0000)]
Merge bitcoindevkit/bdk#1990: How can we be happy if clippy is not?

f4e158a3e415d0131a560156cf8f6bb21c98f6f7 chore(esplora): Allow `dead_code` for helper methods (志宇)
cb7a980b846685bbe38d7ff9b12d11cbf529df76 chore: Make clippy happy (志宇)
93657a0f1e3606e672204aee51dab97dd93b9404 chore: `.gitignore` Exclude criterion results (志宇)

Pull request description:

  ### Description

  I made clippy happy.

  ### Checklists

  #### All Submissions:

  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)

Top commit has no ACKs.

Tree-SHA512: b28afe91dd5d47dfc83a4d14bc47d8efa1e5077448cbbddd1fd74a74232a120e0823d778fa007cde7cfbea52d07ee1f5e719590a56fa143ec9288efc4e56afe1

5 months agotest(chain): Add scenario: coinbase tx must not become unconfirmed
志宇 [Fri, 13 Jun 2025 03:12:59 +0000 (13:12 +1000)]
test(chain): Add scenario: coinbase tx must not become unconfirmed

5 months agochore(esplora): Allow `dead_code` for helper methods
志宇 [Thu, 10 Jul 2025 03:04:24 +0000 (03:04 +0000)]
chore(esplora): Allow `dead_code` for helper methods

This suppresses warnings in CI.

5 months agofix(chain): Unconfirmed coinbase txs should never be canonical
志宇 [Fri, 13 Jun 2025 03:07:37 +0000 (13:07 +1000)]
fix(chain): Unconfirmed coinbase txs should never be canonical

The logic in `CanonicalIter` will consider txs that are anchored to
blocks not in the best chain since they still can appear in the mempool.

However, coinbase txs can never be unconfirmed - which the old logic
failed to exclude.

5 months agochore: Make clippy happy
志宇 [Thu, 10 Jul 2025 03:04:24 +0000 (03:04 +0000)]
chore: Make clippy happy

5 months agochore: `.gitignore` Exclude criterion results
志宇 [Thu, 10 Jul 2025 03:04:24 +0000 (03:04 +0000)]
chore: `.gitignore` Exclude criterion results

5 months agochore(bitcoind_rpc): Make clippy happy
志宇 [Thu, 10 Jul 2025 03:04:24 +0000 (03:04 +0000)]
chore(bitcoind_rpc): Make clippy happy

5 months agoMerge bitcoindevkit/bdk#1979: feat: add `justfile`
merge-script [Thu, 10 Jul 2025 02:13:09 +0000 (02:13 +0000)]
Merge bitcoindevkit/bdk#1979: feat: add `justfile`

501766e7106f043d45b5ab6d29e9af83d6590e13 feat: add `justfile` (Luis Schwab)

Pull request description:

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

  ### Description

  Closes #1967.

  This PR adds a `justfile`, updates the PR template to use it, and adds a section on the `README.md` to show available recipes.

  These are the implemented recipes:
  ```justfile
  alias b := build
  alias c := check
  alias f := fmt
  alias t := test
  alias p := pre-push

  _default:
    @just --list

  # Build the project
  build:
     cargo build

  # Check code: formatting, compilation, linting, and commit signature
  check:
     cargo +nightly fmt --all -- --check
     cargo check --workspace --all-features
     cargo clippy --all-features --all-targets -- -D warnings
     @[ "$(git log --pretty='format:%G?' -1 HEAD)" = "N" ] && \
         echo "\n⚠️  Unsigned commit: BDK requires that commits be signed." || \
         true

  # Format all code
  fmt:
     cargo +nightly fmt

  # Run all tests for all crates with all features enabled
  test:
     @just _test-bitcoind_rpc
     @just _test-chain
     @just _test-core
     @just _test-electrum
     @just _test-esplora
     @just _test-file_store
     @just _test-testenv

  _test-bitcoind_rpc:
      cargo test -p bdk_bitcoind_rpc --all-features

  _test-chain:
      cargo test -p bdk_chain --all-features

  _test-core:
      cargo test -p bdk_core --all-features

  _test-electrum:
      cargo test -p bdk_electrum --all-features

  _test-esplora:
      cargo test -p bdk_esplora --all-features

  _test-file_store:
      cargo test -p bdk_file_store --all-features

  _test-testenv:
      cargo test -p bdk_testenv --all-features

  # Run pre-push suite: format, check, and test
  pre-push: fmt check test
  ```

  `check` will verify if `HEAD` was signed and echo that warning if not. It does not check all commits, but I think that checking only the last is a pretty good heuristic (who signs the last commit only?).

  Before pushing, one only needs to run `just p`.

  ### 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 `just p` before pushing

ACKs for top commit:
  ValuedMammal:
    ACK 501766e7106f043d45b5ab6d29e9af83d6590e13
  evanlinjin:
    ACK 501766e7106f043d45b5ab6d29e9af83d6590e13

Tree-SHA512: b42109c7c3e01f529b794f37bacf8c6c2298243dd5f827c59ce74e7c64a4ef48eac84c4de86280bec828f56a81854c57458d9ea2b10acb83766fc1bdb34d24b6

5 months agofeat(bitcoind_rpc)!: Use `getrawmempool` without verbose
志宇 [Thu, 10 Jul 2025 02:13:09 +0000 (02:13 +0000)]
feat(bitcoind_rpc)!: Use `getrawmempool` without verbose

This is the more performant method. The downside is that mempool txids
are not returned to the seen-in-mempool timestamps so the caller either
needs to provide this, or we need to rely on std to get the current
timestamp.

* `Emitter::mempool` method now requires the `std` feature. A non-std
  version of this is added: `Emitter::mempool_at` which takes in a
  `sync_time` parameter.

Additional changes:

* `NO_EXPECTED_MEMPOOL_TXIDS` is renamed to `NO_EXPECTED_MEMPOOL_TXS`.
* Updated documentation.
* Fix imports so that `bdk_bitcoind_rpc` compiles without `std`.

5 months agofix(bitcoind_rpc)!: Simplify emitter
志宇 [Thu, 3 Jul 2025 23:58:53 +0000 (23:58 +0000)]
fix(bitcoind_rpc)!: Simplify emitter

Instead of having an avoid-reemission logic based on timestamps returned
by bitcoind RPC, we wrap all transactions in `Arc` and always emit the
entire mempool. This makes emission cheap while avoiding the flawed
avoid-reemission logic.

5 months agotest(bitcoind_rpc): Detect new mempool txs
志宇 [Thu, 3 Jul 2025 23:59:14 +0000 (23:59 +0000)]
test(bitcoind_rpc): Detect new mempool txs

5 months agoMerge bitcoindevkit/bdk#1971: esplora: `chain_update` errors if no point of connection
merge-script [Thu, 3 Jul 2025 14:19:29 +0000 (10:19 -0400)]
Merge bitcoindevkit/bdk#1971: esplora: `chain_update` errors if no point of connection

568a36642c43d74132339a4e42dd41c545a764e1 refactor(esplora): in debug build assert that `latest_blocks` is not empty (valued mammal)
dd394cb31869df89c5e5b3bbbf88e26763348878 fix(esplora): `chain_update` errors if no point of connection (valued mammal)

Pull request description:

  ### Description

  Before, the `chain_update` function might have panicked if the local checkpoint was not on the same network as the remote server. Now if we have iterated all of the blocks of the local CP and do not find a point of agreement, then we return early with a `esplora_client::Error::HeaderHashNotFound`.

  cc bitcoindevkit/bdk_wallet#30

  ### Notes to the reviewers

  ### Changelog notice

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo +nightly 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
  * [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:
  ValuedMammal:
    ACK 568a36642c43d74132339a4e42dd41c545a764e1

Tree-SHA512: 8dceaf24f1214d3463e14c7b5965beb34138985319962af04d1027028da2fddece185a7437a33713020e38b2a4129bd14e1dc0a3735e9ece15ab35a5f828360a

5 months agoMerge bitcoindevkit/bdk#1968: bench: Add `reindex_tx_graph` benchmark
merge-script [Thu, 3 Jul 2025 14:01:32 +0000 (10:01 -0400)]
Merge bitcoindevkit/bdk#1968: bench: Add `reindex_tx_graph` benchmark

f51f5b5659941a68b74e5b142296a8aaf9665afa docs(chain): Improve API docs (valued mammal)
fcf38349d895b0c627b4149e448a29468ed629b4 test(keychain_txout): test spk cache (valued mammal)
e07ec1cefbb6cc973398d4281bfde58c8c15cc4b bench(chain): Add `reindex_tx_graph` benchmark (valued mammal)

Pull request description:

  This PR contains the following changes:

  - Add benchmark `reindex_tx_graph`. Run with `cargo bench -p bdk_chain --bench indexer`.
  - Add unit test to `keychain_txout` module to test behavior of spk-cache.
  - Fixup a few doc comments.

  ### 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 +nightly fmt` and `cargo clippy` before committing

ACKs for top commit:
  ValuedMammal:
    ACK f51f5b5659941a68b74e5b142296a8aaf9665afa

Tree-SHA512: 4d6826a825fa40fa13bd622ed6cff49366c541a7e0a7035a45fbeb98853d693ddef7fab113f6d77259fd75eddfc91623834363e028235fb26336c8865fccb02b

5 months agoMerge bitcoindevkit/bdk#1897: test for excluded bounds in outputs_in_range
merge-script [Thu, 3 Jul 2025 13:48:13 +0000 (09:48 -0400)]
Merge bitcoindevkit/bdk#1897: test for excluded bounds in outputs_in_range

ad792670c487e62183d901338b2655ec7b81c688 test for excluded bounds in outputs_in_range (aagbotemi)

Pull request description:

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

  ### Description
  This PR covers a wide range on tests for excluded bounds and the `SpkTxOutIndex::outputs_in_range`. This PR fixes bitcoindevkit/bdk_wallet#58

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

  ### Changelog notice

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

  ### Checklists

  #### All Submissions:

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

  #### New Features:

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

  #### Bugfixes:

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

ACKs for top commit:
  ValuedMammal:
    ACK ad792670c487e62183d901338b2655ec7b81c688
  oleonardolima:
    utACK ad792670c487e62183d901338b2655ec7b81c688

Tree-SHA512: 268e48ce6e7ffb0ed62d0124869caf1fbcff65d787a1a6566a5521408a8b9659a9f25cba5523802e805ac24bfa7809fff51e49c6be59cef6b6ecf4a29ffb9b0a

5 months agoMerge bitcoindevkit/bdk#1957: feat(electrum): optimize merkle proof validation with...
merge-script [Thu, 3 Jul 2025 03:39:18 +0000 (03:39 +0000)]
Merge bitcoindevkit/bdk#1957: feat(electrum): optimize merkle proof validation with batching

156cbab67f4ff91276f9f03749944f4c46210f7f test(electrum): Improve benchmark (志宇)
4ea5ea6c490adb0652ad068bc816c2434c51da35 feat(electrum): batch `transaction.get_merkle` calls via `batch_call` (Wei Chen)
ec4fd971c81e7d3bcf8fbdac15c6df63b934cd70 feat(electrum): batched `Header`s and `script_get_history` (Wei Chen)
f21a21d8c8dfc5b84957c854c1f1daee59bcc620 test(electrum): add `criterion` benchmark for `sync` (Wei Chen)
b57768dd2bd25d4fc9d6acc3990b04fa8594e7b1 fix(electrum): improve tx validation and gap limit scanning (keerthi)
7a18cad68be6bda33deaeb50ec9a5307d1ce8f6d feat(electrum): optimize merkle proof validation with batching (Wei Chen)

Pull request description:

  Replaces #1908, originally authored by @Keerthi421.
  Fixes #1891.

  ### Description

  This PR optimizes `sync`/`full_scan` performance by batching and caching key RPC calls to slash network round-trips and eliminate redundant work.

  Key improvements:

  * Gather all `blockchain.transaction.get_merkle` calls into a single `batch_call` request.
  * Use `batch_script_get_history` instead of many individual `script_get_history` calls.
  * Use `batch_block_header` to fetch all needed block headers in one call rather than repeatedly calling `block_header`.
  * Introduce a cache of transaction anchors to skip re-validating already confirmed transactions.

  #### Anchor Caching Performance Improvements

  Results suggest a significant speed up with a warmed up cache. Tested on local Electrum server with:
  ```
  $ cargo bench -p bdk_electrum --bench test_sync
  ```

  Results before this PR (https://github.com/LagginTimes/bdk/tree/1957-master-branch):

  ```
  sync_with_electrum      time:   [1.3702 s 1.3732 s 1.3852 s]
  ```

  Results after this PR:

  ```
  sync_with_electrum      time:   [851.31 ms 853.26 ms 856.23 ms]
  ```
  #### Batch Call Performance Improvements

  No persisted data was carried over between runs, so each test started with cold caches and measured only raw batching performance. Tested with`example_electrum` out of https://github.com/LagginTimes/bdk/tree/example_electrum_timing with the following parameters:

  ```
  $ example_electrum init "tr([62f3f3af/86'/1'/0']tpubDD4Kse29e47rSP5paSuNPhWnGMcdEDAuiG42LEd5yaRDN2CFApWiLTAzxQSLS7MpvxrpxvRJBVcjhVPRk7gec4iWfwvLrEhns1LA4h7i3c2/0/*)#cn4sudyq"
  $ example_electrum scan tcp://signet-electrumx.wakiyamap.dev:50001
  ```

  Results before this PR:

  ```
  FULL_SCAN TIME: 8.145874476s
  ```

  Results after this PR (using this PR's [`bdk_electrum_client.rs`](https://github.com/bitcoindevkit/bdk/blob/70495e2010541acbb5d62f9b5692de20924ac53f/crates/electrum/src/bdk_electrum_client.rs)):

  ```
  FULL_SCAN TIME: 2.594050112s
  ```

  ### Changelog notice

  * Add transaction anchor cache to prevent redundant network calls.
  * Batch Merkle proof, script history, and header requests.

  ### 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
  * [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:
  oleonardolima:
    tACK 156cbab67f4ff91276f9f03749944f4c46210f7f
  evanlinjin:
    ACK 156cbab67f4ff91276f9f03749944f4c46210f7f

Tree-SHA512: dc7dc1d7de938223cc03293d8bb8ae12c8799c7ec8ba8c7faec5cf2076c96a1b1e50b406cbcc90cbd6cbe7a311c0c11dd036691c03ed067c469a26260903993b

5 months agofeat: add `justfile`
Luis Schwab [Tue, 1 Jul 2025 17:06:39 +0000 (14:06 -0300)]
feat: add `justfile`

5 months agodocs(chain): Improve API docs
valued mammal [Fri, 30 May 2025 17:22:07 +0000 (13:22 -0400)]
docs(chain): Improve API docs

Fixed parameter names to match the function or struct definition,
and correct some spelling mistakes.

5 months agotest(keychain_txout): test spk cache
valued mammal [Fri, 30 May 2025 17:16:02 +0000 (13:16 -0400)]
test(keychain_txout): test spk cache

- Test cached spk matches derived
- Recover state of spk cache from changeset

5 months agobench(chain): Add `reindex_tx_graph` benchmark
valued mammal [Mon, 26 May 2025 02:04:27 +0000 (22:04 -0400)]
bench(chain): Add `reindex_tx_graph` benchmark

5 months agorefactor(esplora): in debug build assert that `latest_blocks` is not empty
valued mammal [Sat, 7 Jun 2025 14:43:11 +0000 (10:43 -0400)]
refactor(esplora): in debug build assert that `latest_blocks` is not empty

5 months agofix(esplora): `chain_update` errors if no point of connection
valued mammal [Thu, 5 Jun 2025 17:17:21 +0000 (13:17 -0400)]
fix(esplora): `chain_update` errors if no point of connection

Before, the `chain_update` function would hit a panic if the
local checkpoint was not on the same network as the remote
server. Now if we have iterated all of the blocks of the
`local_cp` and do not find a "point of agreement", then we
return early with a `esplora_client::Error::HeaderHashNotFound`.

5 months agotest(electrum): Improve benchmark
志宇 [Wed, 25 Jun 2025 23:34:50 +0000 (23:34 +0000)]
test(electrum): Improve benchmark

* Actually use different spks
* Do not benchmark applying updates (only fetching/contructing)
* Have two benches: One with cache, one without.
* Remove `black_box`.

5 months agofeat(electrum): batch `transaction.get_merkle` calls via `batch_call`
Wei Chen [Tue, 27 May 2025 18:15:44 +0000 (18:15 +0000)]
feat(electrum): batch `transaction.get_merkle` calls via `batch_call`

5 months agofeat(electrum): batched `Header`s and `script_get_history`
Wei Chen [Mon, 26 May 2025 23:18:07 +0000 (23:18 +0000)]
feat(electrum): batched `Header`s and `script_get_history`

5 months agotest(electrum): add `criterion` benchmark for `sync`
Wei Chen [Sun, 25 May 2025 18:28:19 +0000 (18:28 +0000)]
test(electrum): add `criterion` benchmark for `sync`

6 months agofix(electrum): improve tx validation and gap limit scanning
keerthi [Thu, 10 Apr 2025 09:21:26 +0000 (14:51 +0530)]
fix(electrum): improve tx validation and gap limit scanning

6 months agofeat(electrum): optimize merkle proof validation with batching
Wei Chen [Sat, 22 Mar 2025 12:16:12 +0000 (17:46 +0530)]
feat(electrum): optimize merkle proof validation with batching

Co-authored-by: keerthi <keerthi.sree2105@gmail.com>
6 months agotest for excluded bounds in outputs_in_range
aagbotemi [Tue, 18 Mar 2025 01:18:04 +0000 (02:18 +0100)]
test for excluded bounds in outputs_in_range

- replace range syntax with explicit Bound types in outputs_in_range tests

6 months agoMerge bitcoindevkit/bdk#1978: ci: automated update to rustc 1.87.0
Steve Myers [Tue, 17 Jun 2025 20:35:49 +0000 (15:35 -0500)]
Merge bitcoindevkit/bdk#1978: ci: automated update to rustc 1.87.0

54e2b533a261ade79bfc6e17215ddde22c5f3248 ci: automated update to rustc 1.87.0 (Github Action)

Pull request description:

  Automated update to Github CI workflow `cont_integration.yml` by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action

ACKs for top commit:
  ValuedMammal:
    ACK 54e2b533a261ade79bfc6e17215ddde22c5f3248
  notmandatory:
    ACK 54e2b533a261ade79bfc6e17215ddde22c5f3248

Tree-SHA512: ead615e82de3f30980733c85271b9fc85644705750fbb4a1d6812831923da3370292bd7864e5ecc1b4ac182ad0d6ff22a861669a9cda7bbb1d9dc414abf82954

6 months agoci: automated update to rustc 1.87.0
Github Action [Sun, 15 Jun 2025 01:23:55 +0000 (01:23 +0000)]
ci: automated update to rustc 1.87.0

6 months agoMerge bitcoindevkit/bdk#1972: ci: pin `tracing-core` to `0.1.33` for msrv
merge-script [Fri, 13 Jun 2025 07:49:59 +0000 (07:49 +0000)]
Merge bitcoindevkit/bdk#1972: ci: pin `tracing-core` to `0.1.33` for msrv

7c8b4db50987bd6f17df4ac60fb513cdc33c5e2f ci: pin `tracing-core` to `0.1.33` (Wei Chen)

Pull request description:

  ### Description

  Pin `tracing-core` to `0.1.33` for msrv.

  ### Changelog notice

  * Pin `tracing-core` to `0.1.33`.

  ### 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 +nightly fmt` and `cargo clippy` before committing

ACKs for top commit:
  ValuedMammal:
    ACK 7c8b4db50987bd6f17df4ac60fb513cdc33c5e2f
  oleonardolima:
    ACK 7c8b4db50987bd6f17df4ac60fb513cdc33c5e2f

Tree-SHA512: 2bbca7a6506a3a083cc3a13aa0221dd5d5442c7435bf57f5bfe01d48365b1eab355caf9cb27ee7c57f4adc4d3aa621f6f3ec9379f4b03d5d9a5f9e2284d64785

6 months agoci: pin `tracing-core` to `0.1.33`
Wei Chen [Sun, 8 Jun 2025 17:39:35 +0000 (17:39 +0000)]
ci: pin `tracing-core` to `0.1.33`

6 months agoMerge bitcoindevkit/bdk#1970: chore: bump `bdk_chain` to 0.23.0 bitcoind_rpc-0.20.0 chain-0.23.0 core-0.6.0 electrum-0.23.0 esplora-0.22.0 file_store-0.21.0 testenv-0.13.0
valued mammal [Tue, 27 May 2025 15:06:03 +0000 (11:06 -0400)]
Merge bitcoindevkit/bdk#1970: chore: bump `bdk_chain` to 0.23.0

6afb6a6213d9e2667df669e91faab20df5ffc056 chore: update changelogs (valued mammal)
340bdc1c7a6a8382e3c6ed75e1938be9b0c957e1 chore: bump `bdk_chain` to 0.23.0 (valued mammal)

Pull request description:

  core to 0.6.0
  bitcoind_rpc to 0.20.0
  electrum to 0.23.0
  esplora to 0.22.0
  file_store 0.21.0
  testenv to 0.13.0

  TODO

  - [x] Update changelogs

  fixes #1969

ACKs for top commit:
  oleonardolima:
    ACK 6afb6a6213d9e2667df669e91faab20df5ffc056

Tree-SHA512: 844c4c3db714877351bba01eedca476d73973fa88be41c13220936dbec4853097d3322f8018b74e9a80233f34e3ed5a57a02b46cc3c85cdf28b6e5890077f34d

6 months agochore: update changelogs
valued mammal [Tue, 27 May 2025 14:41:12 +0000 (10:41 -0400)]
chore: update changelogs

6 months agochore: bump `bdk_chain` to 0.23.0
valued mammal [Mon, 26 May 2025 23:16:03 +0000 (19:16 -0400)]
chore: bump `bdk_chain` to 0.23.0

core to 0.6.0
bitcoind_rpc to 0.20.0
electrum to 0.23.0
esplora to 0.22.0
file_store 0.21.0
testenv to 0.13.0

6 months agoMerge bitcoindevkit/bdk#1963: Persist spks derived from `KeychainTxOutIndex`
valued mammal [Tue, 27 May 2025 14:03:47 +0000 (10:03 -0400)]
Merge bitcoindevkit/bdk#1963: Persist spks derived from `KeychainTxOutIndex`

62767f0702e6497d08fea702b747fd6e7fa72b8c fix(rusqlite_impl): Fix derived spks create table statement (valued mammal)
603f133d9adf0e933c270c40b0f5284eca7c5722 docs(chain): Adds docs for persisting spks in `KeychainTxOutIndex` (志宇)
3126cd214536db6c9636f4e7b6b92019fcee535e feat(chain)!: Clean up ergonomics of `IndexedTxGraph` (志宇)
a0555817136e4ef5a36272cb311123e0bce54657 feat(chain): `KeychainTxOutIndex`: Make spk cache optional (志宇)
19e3b5df1b25d206c3b1eecefd7befc783dce127 feat(chain): Add `KeychainTxOutIndex::from_changeset` constructor (志宇)
d761265af0586b4425c8f0ee4515e8b9f3fff247 feat(chain): `KeychainTxOutIndex`: Debug build checks (志宇)
76875e7a4ea36ed5ae4b5ae211068111d3f28813 fix(chain)!: API and logical issues in `KeychainTxOutIndex` (志宇)
d299daea4278f9c63fcf57ae7b7079c0b6f7ebc4 feat(chain)!: Persist spks derived from `KeychainTxOutIndex` (志宇)

Pull request description:

  Replaces #1960
  Fixes #1964

  ### Description

  Users with large wallet and/or complex descriptors may experience slow startup of `KeychainTxOutIndex`. This PR addresses this problem by providing the option to persist derived spks so that they no longer need to be re-derived on startup.

  The `IndexedTxGraph` API has been changed for better ergonomics.

  Compared to #1960, this is a more longterm solution that does not depend on multi-threading logic.

  ### Changelog notice

  ```md
  Changed
    - `KeychainTxOutIndex::new` to take in an additional parameter `persist_spks` to control whether derived spks are cached and persisted across restarts. The default of `persist_spks` is false.
    - `KeychainTxOutIndex` methods (`lookahead_to_target, `next_unused_spk`, `reveal_next_spk`) now return changesets as they may derive spks to be persisted.
    - The `InsertDescriptorError` type now wraps descriptors in `Box` to reduce enum size.

  Added
    - `spk_cache` field to `indexer::keychain_txout::ChangeSet` which persists derived spks.
    - `IndexedTxGraph::from_changeset` - allows constructing from `indexed_tx_graph::ChangeSet` and only indexing when ready.
    - `IndexedTxGraph::reindex` method.

  Fixed
    - `KeychainTxOutIndex::reveal_to_target` so that it actually returns `None` if the `keychain` does not 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 +nightly fmt` and `cargo clippy` before committing

  #### New Features:

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

ACKs for top commit:
  ValuedMammal:
    ACK 62767f0702e6497d08fea702b747fd6e7fa72b8c
  notmandatory:
    ACK 62767f0702e6497d08fea702b747fd6e7fa72b8c

Tree-SHA512: dc1aa4308ffcc6d121e0d7a1ca4ff9f641ed5db63204747fde47ac02e45dae9b65da95554541705a98b69e59f741c043485a26db736966417061a4c9d220ba29

6 months agofix(rusqlite_impl): Fix derived spks create table statement
valued mammal [Mon, 26 May 2025 14:10:24 +0000 (10:10 -0400)]
fix(rusqlite_impl): Fix derived spks create table statement

Do not reference last revealed table, in case none are revealed.
Correct SQL column name.

6 months agoMerge bitcoindevkit/bdk#1966: fix(chain): persist `first_seen`
merge-script [Fri, 23 May 2025 12:10:11 +0000 (22:10 +1000)]
Merge bitcoindevkit/bdk#1966: fix(chain): persist `first_seen`

b27a019b595545ffe8fed6b77aeccb68f7b23938 fix(chain): persist `first_seen` (Wei Chen)

Pull request description:

  Fixes #1965.

  ### Description

  Adds missing persistence for `first_seen`, which was not included in #1950.

  ### Changelog notice

  - Adds `first_seen` column to the `bdk_txs` table via schema v3 migration.
  - Updates `from_sqlite()` and `persist_to_sqlite()` to handle `first_seen`.
  - Updates the v0-to-v3 migration test to verify compatibility with older schemas.

  ### 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 +nightly 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
  * [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 b27a019b595545ffe8fed6b77aeccb68f7b23938

Tree-SHA512: a8c4cd930e20f7bdf1a02fc3155b5df9f1627676fe10a2d77ea856e71e45f783bba1bb8cf4eceb8dba71c345e7985a9e091002966cec147871e6672c0e2ac5c4

6 months agoMerge bitcoindevkit/bdk#1961: Add `is_empty` methods to `TxUpdate` and `{}_Response...
merge-script [Fri, 23 May 2025 11:59:05 +0000 (21:59 +1000)]
Merge bitcoindevkit/bdk#1961: Add `is_empty` methods to `TxUpdate` and `{}_Response` types

e9263f9b70271cbcfd67c2f5b250c447ba1fd4fe feat(core): Add `is_empty` methods to `TxUpdate` and `{}_Response` types (志宇)

Pull request description:

  ### Description

  `is_empty` methods are helpful in various contexts so I added them.

  ### Changelog notice

  ```md
  Added
    - `is_empty` methods to `TxUpdate`, `SyncResponse` and `FullScanResponse`
  ```

  ### 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:
  LagginTimes:
    ACK e9263f9b70271cbcfd67c2f5b250c447ba1fd4fe

Tree-SHA512: 767a581b5d66da31f609db3ffba2457cb0f579c386e8e960bd89d6650852ba9d3c00e94432aaeba586d19b01fa8982ffdee2615c867b98ad8efa8e16505e3180

6 months agodocs(chain): Adds docs for persisting spks in `KeychainTxOutIndex`
志宇 [Fri, 23 May 2025 11:23:38 +0000 (21:23 +1000)]
docs(chain): Adds docs for persisting spks in `KeychainTxOutIndex`