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

6 months agofix(chain): persist `first_seen`
Wei Chen [Fri, 23 May 2025 11:12:14 +0000 (11:12 +0000)]
fix(chain): persist `first_seen`

6 months agofeat(chain)!: Clean up ergonomics of `IndexedTxGraph`
志宇 [Fri, 23 May 2025 08:27:55 +0000 (18:27 +1000)]
feat(chain)!: Clean up ergonomics of `IndexedTxGraph`

* `new` is now intended to construct a fresh indexed-tx-graph
* `from_changeset` is added for constructing indexed-tx-graph from a
  previously persisted changeset
* added `reindex` for calling after indexer mutations that require it
* reintroduce `Default` impl

6 months agofeat(core): Add `is_empty` methods to `TxUpdate` and `{}_Response` types
志宇 [Sun, 18 May 2025 23:52:17 +0000 (09:52 +1000)]
feat(core): Add `is_empty` methods to `TxUpdate` and `{}_Response` types

6 months agofeat(chain): `KeychainTxOutIndex`: Make spk cache optional
志宇 [Fri, 23 May 2025 05:44:35 +0000 (15:44 +1000)]
feat(chain): `KeychainTxOutIndex`: Make spk cache optional

Also added staging changes to `ChangeSet::spk_cache`. This way, we can
avoid returning `ChangeSet`s for `apply_changeset` and
`insert_descriptor`.

* `KeychainTxOutIndex::new` now takes in an additional `use_spk_cache`
  parameter.
* Fixed `reveal_to_target` method to actually return `None` if the
  keychain does not exist.

6 months agofeat(chain): Add `KeychainTxOutIndex::from_changeset` constructor
志宇 [Fri, 23 May 2025 01:51:12 +0000 (11:51 +1000)]
feat(chain): Add `KeychainTxOutIndex::from_changeset` constructor

This incentivies constructing `KeychainTxOutIndex` from a changeset
before inserting descriptors (to make use of the spk cache).

6 months agofeat(chain): `KeychainTxOutIndex`: Debug build checks
志宇 [Fri, 23 May 2025 01:24:21 +0000 (11:24 +1000)]
feat(chain): `KeychainTxOutIndex`: Debug build checks

* When merging changesets, assert that spk of a given descriptor id &
  derivation index does not get changed.
* When reading spk from cache, check the spk by deriving it.

6 months agofix(chain)!: API and logical issues in `KeychainTxOutIndex`
志宇 [Fri, 23 May 2025 00:47:26 +0000 (10:47 +1000)]
fix(chain)!: API and logical issues in `KeychainTxOutIndex`

Thanks to @valuedmammal for the suggestions

6 months agofeat(chain)!: Persist spks derived from `KeychainTxOutIndex`
志宇 [Thu, 22 May 2025 07:14:18 +0000 (17:14 +1000)]
feat(chain)!: Persist spks derived from `KeychainTxOutIndex`

6 months agoMerge bitcoindevkit/bdk#1946: chore: create and apply rustfmt.toml
Steve Myers [Wed, 21 May 2025 15:29:07 +0000 (10:29 -0500)]
Merge bitcoindevkit/bdk#1946: chore: create and apply rustfmt.toml

7bdbcdd2a1b6bb0fb9fafd7792615a1a3a302a5a chore: apply fmt (Luis Schwab)
655b77b4ddc8982c3c747f5553abb83801b09a0b chore: create rustfmt.toml, update CI to use nightly for fmt job (Luis Schwab)

Pull request description:

  This PR adds basic formatting configuration for uniform comments. Note that the nightly toolchain is necessary.

  ### Changelog:

  - Create rustfmt.toml with this config:
  ```
  comment_width = 100
  format_code_in_doc_comments = true
  wrap_comments = true
  ```
  - Apply rustfmt.toml.
  - Update the fmt CI job to use the nightly toolchain.
  - Update PR template to use nightly toolchain.

  Note: I had to add #[rustfmt::skip] to test_extract_satisfaction_timelock() because the base64 PSBT would get wrapped due to the slashes.

  #### 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:
  notmandatory:
    ACK 7bdbcdd2a1b6bb0fb9fafd7792615a1a3a302a5a

Tree-SHA512: 03b056e1da5733e8aa9a9244192b48a5c170902216d936ddbeaf81e22608fee3344ae6386a06019c7806f0a3e1597ab5be34f78661809181693c63954a61cce0

6 months agochore: apply fmt
Luis Schwab [Tue, 20 May 2025 21:36:47 +0000 (18:36 -0300)]
chore: apply fmt

6 months agochore: create rustfmt.toml, update CI to use nightly for fmt job
Luis Schwab [Fri, 16 May 2025 14:12:34 +0000 (11:12 -0300)]
chore: create rustfmt.toml, update CI to use nightly for fmt job

7 months agoMerge bitcoindevkit/bdk#1813: Add zizmor github actions security analysis workflow
Steve Myers [Tue, 20 May 2025 18:22:49 +0000 (13:22 -0500)]
Merge bitcoindevkit/bdk#1813: Add zizmor github actions security analysis workflow

a50fa4c1014ad0739f2ca4d51738b1f1207d679f ci: add zizmor github actions security analysis workflow (Steve Myers)

Pull request description:

  ### Description

  Added workflow to run zizmor github actions security analysis.

  See: https://woodruffw.github.io/zizmor/usage/#use-in-github-actions

  ### Notes to the reviewers

  I built this PR on top of #1778.

  I pinned zizmor to version 1.6.0.

  ### Changelog notice

  ci: add zizmor github actions security analysis workflow and fix possible vulnerabilities

  ### Checklists

  #### All Submissions:

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

Top commit has no ACKs.

Tree-SHA512: 5eaa6b6ce59fb3f724a368098174000e096ddc0c798c5132e089a02c611f5132ea9e123418c54cb98628361de80faaf562742eae45ccb68c5040e7475f948b72

7 months agoci: add zizmor github actions security analysis workflow
Steve Myers [Tue, 28 Jan 2025 02:19:30 +0000 (20:19 -0600)]
ci: add zizmor github actions security analysis workflow

7 months agoMerge bitcoindevkit/bdk#1955: chore: Update rust-version to 1.86.0
merge-script [Mon, 19 May 2025 00:47:05 +0000 (10:47 +1000)]
Merge bitcoindevkit/bdk#1955: chore: Update rust-version to 1.86.0

e8c911c464ff7f0d35259cccee0d286c11f04bb2 chore: update rust-version to 1.86.0 (valued mammal)

Pull request description:

  Update `rust-version` to 1.86.0 and address some clippy lints, in particular [`clippy::doc_overindented_list_items`](https://rust-lang.github.io/rust-clippy/master/index.html#doc_overindented_list_items).

  fix #1940

  ### 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:
    re-ACK e8c911c464ff7f0d35259cccee0d286c11f04bb2

Tree-SHA512: e09377f4b31f7da1a74f4cc4b3a7d7f5f7235aac00001adc3cf4b5758efd0383facb367348db2173bd88379259d0d465292d4dd0ab68bc3b61a0bf111b989e7a

7 months agoMerge bitcoindevkit/bdk#1806: fix(docs): `merge_chains` outdated documentation
merge-script [Fri, 16 May 2025 08:55:32 +0000 (18:55 +1000)]
Merge bitcoindevkit/bdk#1806: fix(docs): `merge_chains` outdated documentation

5647241f45b29fe5f7ad5aa5a94c0c4f72f9adea fix(docs): `merge_chains` documentation (Leonardo Lima)

Pull request description:

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

  ### Description

  It's a minor documentation fix, as reported during the audit and referenced in bitcoindevkit/bdk_wallet#59.

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

  ### Notes to the reviewers

  I'm unsure if anything else / any other explanation should be included in the documentation. Let me know if you think more context should be added to it.

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

  - Update `bdk_chain::local_chain::merge_chains` documentation.

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

ACKs for top commit:
  evanlinjin:
    self-ACK 5647241f45b29fe5f7ad5aa5a94c0c4f72f9adea

Tree-SHA512: a70a67eab9c8fa0c60a674efed82ddeb9bc9b69763fefaa38a9058d7a1e67c06045c3e5a31aaf0d48c0a599d03bac0a3a86530cc250acefea9497572c01b8b0e

7 months agofix(docs): `merge_chains` documentation
Leonardo Lima [Tue, 21 Jan 2025 20:56:00 +0000 (17:56 -0300)]
fix(docs): `merge_chains` documentation

- it's a small fix for `merge_chains` docs, reported on audit.
- adds an `Errors` section to cover what scenarios it can fail.

7 months agochore: update rust-version to 1.86.0
valued mammal [Wed, 30 Apr 2025 21:12:26 +0000 (17:12 -0400)]
chore: update rust-version to 1.86.0

Clippy was complaining about overindented list items, so fix
that here as well.

7 months agoMerge bitcoindevkit/bdk#1950: feat!(chain): implement `first_seen` tracking
merge-script [Fri, 16 May 2025 06:13:18 +0000 (16:13 +1000)]
Merge bitcoindevkit/bdk#1950: feat!(chain): implement `first_seen` tracking

8b17bcfc03c39cd35415742bc31293b7969d1024 feat!(chain): implement `first_seen` tracking (uvuvuwu)

Pull request description:

  ### Description

  This PR solves issue #1947 by implementing `first_seen` tracking.

  * Added `first_seen` field to `TxGraph` and `ChangeSet` so that `first_seen` timestamp can be added when inserting a new seen-at using `insert_seen_at`.

  * `first_seen` added to `TxNode` as a way to retrieve the first-seen timestamp for a transaction.

  * `first_seen` added to `ChainPosition::Unconfirmed` to order unconfirmed transactions by `first_seen`.

  * New tests have been added for the above described functionalities.

  ### Changelog notice

  * Add tracking first-seen timestamps of transactions

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

  ### Checklists

  #### All Submissions:

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

  #### New Features:

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

ACKs for top commit:
  evanlinjin:
    ACK 8b17bcfc03c39cd35415742bc31293b7969d1024

Tree-SHA512: effb95704181f80ca25b63f5cf42b7a9357895647abefa91d4cc7ade7604bcfa4cca663d3916b935b520d935cf562412c5238f96636a428d115bf56b1957c9d5

7 months agofeat!(chain): implement `first_seen` tracking
uvuvuwu [Thu, 24 Apr 2025 04:34:11 +0000 (16:34 +1200)]
feat!(chain): implement `first_seen` tracking

7 months agoMerge bitcoindevkit/bdk#1951: Release `bdk_chain` v0.22.0 bitcoind_rpc-0.19.0 chain-0.22.0 core-0.5.0 electrum-0.22.0 esplora-0.21.0 file_store-0.20.0 testenv-0.12.0
valued mammal [Thu, 1 May 2025 15:37:11 +0000 (11:37 -0400)]
Merge bitcoindevkit/bdk#1951: Release `bdk_chain` v0.22.0

4c34331289beaf7b8968ca069b3bfa596523ea06 chore: Update changelogs (valued mammal)
ba4e7fdfc6fa70f8690041f4223d7ac2ec8dcf69 chore: bump bdk_chain to 0.22.0 (valued mammal)

Pull request description:

  chore: bump bdk_chain to 0.22.0

  - bdk_core 0.5.0
  - bitcoind_rpc 0.19.0
  - electrum 0.22.0
  - esplora 0.21.0
  - file_store 0.20.0
  - testenv 0.12.0

  fixes #1945

ACKs for top commit:
  LagginTimes:
    ACK 4c34331289beaf7b8968ca069b3bfa596523ea06

Tree-SHA512: ba9a4fd160373e12bc88db3474a48724ed83f88d35f562d26d5e59005320d585d20ffe1d115295f9bd6caa0d1996010e0e6158f17c47508d177dbe7b499ec8a2

7 months agochore: Update changelogs
valued mammal [Sat, 26 Apr 2025 16:24:40 +0000 (12:24 -0400)]
chore: Update changelogs

7 months agochore: bump bdk_chain to 0.22.0
valued mammal [Sat, 26 Apr 2025 16:23:37 +0000 (12:23 -0400)]
chore: bump bdk_chain to 0.22.0

- bdk_core 0.5.0
- bitcoind_rpc 0.19.0
- electrum 0.22.0
- esplora 0.21.0
- file_store 0.20.0
- testenv 0.12.0

7 months agoMerge bitcoindevkit/bdk#1857: feat(rpc)!: Update `Emitter::mempool` to support `evict...
valued mammal [Thu, 1 May 2025 15:07:40 +0000 (11:07 -0400)]
Merge bitcoindevkit/bdk#1857: feat(rpc)!: Update `Emitter::mempool` to support `evicted_at`

8513d83a2ef2fe748e9007984187a7f08d256ee6 feat(bitcoind_rpc)!: Reduce friction of `Emitter` API. (志宇)
0a02d26835a41556cf0f6899f97fdb42bf4d0f9d feat(chain): Add convenience conversions for `CanonicalTx` (志宇)
d11f6efe8f6feddaa115cde32ebead19f92c2f64 feat(graph): add convenience function for inserting relevant `evicted_at`s (Wei Chen)
28ef7c9a22c4364925329628fa84fd09ecc82e2e refactor(rpc)!: update `mempool` interface and test code (valued mammal)

Pull request description:

  Fixes #1740

  ### Description

  Work for this began as part of #1811, based on this [comment](https://github.com/bitcoindevkit/bdk/pull/1811#discussion_r1945941691).

  `Emitter::mempool` now returns a `MempoolEvent` which provides the data for tracking `evicted_at`:

  ```
  pub struct MempoolEvent {
      /// Unemitted transactions or transactions with ancestors that are unseen by the receiver.
      ///
      /// To understand the second condition, consider a receiver which filters transactions based on
      /// whether it alters the UTXO set of tracked script pubkeys. If an emitted mempool transaction
      /// spends a tracked UTXO which is confirmed at height `h`, but the receiver has only seen up to
      /// block of height `h-1`, we want to re-emit this transaction until the receiver has seen the
      /// block at height `h`.
      pub new_txs: Vec<(Transaction, u64)>,

      /// [`Txid`]s of all transactions that have been evicted from mempool.
      pub evicted_txids: HashSet<Txid>,

      /// The latest timestamp of when a transaction entered the mempool.
      ///
      /// This is useful for setting the timestamp for evicted transactions.
      pub latest_update_time: u64,
  }
  ```

  ### Changelog notice

  * Change `Emitter::mempool` to return `MempoolEvent`s which contain mempool-eviction data.
  * Change `Emitter::client` to have more relaxed generic bounds. `C: Deref, C::Target: RpcApi` are the new bounds.
  * Add conversion impls for `CanonicalTx` to `Txid`/`Arc<Transaction>`.
  * Add `ChainPosition::is_unconfirmed` method.

  ### Checklists

  #### All Submissions:

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

  #### New Features:

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

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

Tree-SHA512: 28149458085dc4cefefe06656769d701b53f891c1ecb5d400aba8b23d63c026d6e4db1c9e6f47c8ad167edc1559d897d28e9bb71e7bd144792b5cecc0bcd31ce

7 months agofeat(bitcoind_rpc)!: Reduce friction of `Emitter` API.
志宇 [Thu, 1 May 2025 00:36:10 +0000 (10:36 +1000)]
feat(bitcoind_rpc)!: Reduce friction of `Emitter` API.

* Change signature of `Emitter::new` so that `expected_mempool_txids`
  can be more easily constructed from `TxGraph` methods.
* Change generic bounds of `C` within `Emitter<C>` to be `C: DeRef,
  C::Target: RpcApi`. This allows the caller to have `Arc<Client>` as
  `C` and does not force to caller to hold a lifetimed reference.

7 months agofeat(chain): Add convenience conversions for `CanonicalTx`
志宇 [Thu, 1 May 2025 00:28:42 +0000 (10:28 +1000)]
feat(chain): Add convenience conversions for `CanonicalTx`

* `From<CanonicalTx> for Txid`
* `From<CanonicalTx> for Arc<Transaction>`

Also added a convenience method `ChainPosition::is_unconfirmed`.

These are intended to simplify the calls needed to populate the
`expected_mempool_txids` field of `Emitter::new`.

7 months agofeat(graph): add convenience function for inserting relevant `evicted_at`s
Wei Chen [Fri, 25 Apr 2025 07:29:36 +0000 (07:29 +0000)]
feat(graph): add convenience function for inserting relevant `evicted_at`s

7 months agorefactor(rpc)!: update `mempool` interface and test code
valued mammal [Sat, 1 Feb 2025 15:15:55 +0000 (10:15 -0500)]
refactor(rpc)!: update `mempool` interface and test code

7 months agoMerge bitcoindevkit/bdk#1808: Introduce canonicalization parameters
valued mammal [Thu, 1 May 2025 14:19:35 +0000 (10:19 -0400)]
Merge bitcoindevkit/bdk#1808: Introduce canonicalization parameters

53afb3511cb472c0fd91ccf2815fa0c44ffc56ba test(graph): Add additional witness scenarios (Wei Chen)
46af2a5ca4182a0b654c42e672f2a58bd39b5b96 feat(chain)!: Add ability to modify canonicalization algorithm (志宇)
58fcf3287be09d28a34243cf7aa02b8de1012148 refactor(chain): Make private fields in `CanonicalIter` concise. (志宇)
5eb5e86b5e456a571a7bd217fb7117f5acf8cf41 feat(chain): Signed txs should displace unsigned txs in `TxGraph`. (志宇)

Pull request description:

  Partially Fixes bitcoindevkit/bdk_wallet#40

  ### Description

  Add the ability to modify the canonicalization algorithm. Right now, the only modifier is `assume_canonical` which takes in a `Vec` (ordered list) of txids and superimposes it on the canonicalization algorithm. Txs later in the list (higher index) have a higher priority (in case of conflicts).

  ### Notes to the reviewers

  None at the moment.

  ### Changelog notice

  * Added `CanonicalizationParams` to allow the caller to modify the canonicalization algorithm. This in a new parameter on `CanonicalIter::new`.
  * Changed `TxGraph::insert_tx` to allow for updating a transaction's witness field. This is useful for initially introducing an unsigned tx and adding witnesses later on.

  ### 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:
  LagginTimes:
    ACK 53afb3511cb472c0fd91ccf2815fa0c44ffc56ba
  ValuedMammal:
    ACK 53afb3511cb472c0fd91ccf2815fa0c44ffc56ba

Tree-SHA512: 9fd070a3829d194f4d216c873922d9d47e047fa4b618628b875456f5cf4661d6b6c08a3a0dd4739b3a0f765e47c7c99acca53f195379e37f0f9cfed027bde17b

7 months agotest(graph): Add additional witness scenarios
Wei Chen [Mon, 28 Apr 2025 18:07:59 +0000 (18:07 +0000)]
test(graph): Add additional witness scenarios

7 months agofeat(chain)!: Add ability to modify canonicalization algorithm
志宇 [Thu, 23 Jan 2025 04:16:46 +0000 (15:16 +1100)]
feat(chain)!: Add ability to modify canonicalization algorithm

Introduce `CanonicalizationParams` which is passed in to
`CanonicalIter::new`.

`CanonicalizationParams::assume_canonical` is the only field right now.
This contains a list of txids that we assume to be canonical,
superceding any other canonicalization rules.

7 months agoMerge bitcoindevkit/bdk#1910: build(deps): bump Swatinem/rust-cache from 2.7.7 to...
Steve Myers [Thu, 1 May 2025 02:18:21 +0000 (21:18 -0500)]
Merge bitcoindevkit/bdk#1910: build(deps): bump Swatinem/rust-cache from 2.7.7 to 2.7.8

883afeef93265ae066dfa7f297433d5503edc0e6 build(deps): bump Swatinem/rust-cache from 2.7.7 to 2.7.8 (dependabot[bot])

Pull request description:

  Bumps [Swatinem/rust-cache](https://github.com/swatinem/rust-cache) from 2.7.7 to 2.7.8.
  <details>
  <summary>Release notes</summary>
  <p><em>Sourced from <a href="https://github.com/swatinem/rust-cache/releases">Swatinem/rust-cache's releases</a>.</em></p>
  <blockquote>
  <h2>v2.7.8</h2>
  <h2>What's Changed</h2>
  <ul>
  <li>Include CPU arch in the cache key for arm64 Linux runners by <a href="https://github.com/rhysd"><code>@rhysd</code></a> in <a href="https://redirect.github.com/Swatinem/rust-cache/pull/228">Swatinem/rust-cache#228</a></li>
  </ul>
  <p><strong>Full Changelog</strong>: <a href="https://github.com/Swatinem/rust-cache/compare/v2.7.7...v2.7.8">https://github.com/Swatinem/rust-cache/compare/v2.7.7...v2.7.8</a></p>
  </blockquote>
  </details>
  <details>
  <summary>Changelog</summary>
  <p><em>Sourced from <a href="https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md">Swatinem/rust-cache's changelog</a>.</em></p>
  <blockquote>
  <h2>2.7.8</h2>
  <ul>
  <li>Include CPU arch in the cache key</li>
  </ul>
  </blockquote>
  </details>
  <details>
  <summary>Commits</summary>
  <ul>
  <li><a href="https://github.com/Swatinem/rust-cache/commit/9d47c6ad4b02e050fd481d890b2ea34778fd09d6"><code>9d47c6a</code></a> 2.7.8</li>
  <li><a href="https://github.com/Swatinem/rust-cache/commit/27b8ea9368cf428f0bfe41b0876b1a7e809d9844"><code>27b8ea9</code></a> Include CPU arch in the cache key (<a href="https://redirect.github.com/swatinem/rust-cache/issues/228">#228</a>)</li>
  <li>See full diff in <a href="https://github.com/swatinem/rust-cache/compare/v2.7.7...v2.7.8">compare view</a></li>
  </ul>
  </details>
  <br />

  [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=Swatinem/rust-cache&package-manager=github_actions&previous-version=2.7.7&new-version=2.7.8)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

  Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

  [//]: # (dependabot-automerge-start)
  [//]: # (dependabot-automerge-end)

  ---

  <details>
  <summary>Dependabot commands and options</summary>
  <br />

  You can trigger Dependabot actions by commenting on this PR:
  - `@dependabot rebase` will rebase this PR
  - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
  - `@dependabot merge` will merge this PR after your CI passes on it
  - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
  - `@dependabot cancel merge` will cancel a previously requested merge and block automerging
  - `@dependabot reopen` will reopen this PR if it is closed
  - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
  - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

  </details>

ACKs for top commit:
  notmandatory:
    ACK 883afeef93265ae066dfa7f297433d5503edc0e6

Tree-SHA512: 5687a1e279223b8b923ae8fac9d221b37d343a273c688743794c646971fd4aec9022d1a7379c8708159b8df03bfca5b16b1dc4ae5847836279d2c403a062fa71

7 months agobuild(deps): bump Swatinem/rust-cache from 2.7.7 to 2.7.8 github/dependabot/github_actions/Swatinem/rust-cache-2.7.8
dependabot[bot] [Thu, 1 May 2025 02:09:49 +0000 (02:09 +0000)]
build(deps): bump Swatinem/rust-cache from 2.7.7 to 2.7.8

Bumps [Swatinem/rust-cache](https://github.com/swatinem/rust-cache) from 2.7.7 to 2.7.8.
- [Release notes](https://github.com/swatinem/rust-cache/releases)
- [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md)
- [Commits](https://github.com/swatinem/rust-cache/compare/v2.7.7...v2.7.8)

---
updated-dependencies:
- dependency-name: Swatinem/rust-cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
7 months agorefactor(chain): Make private fields in `CanonicalIter` concise.
志宇 [Thu, 23 Jan 2025 02:33:43 +0000 (13:33 +1100)]
refactor(chain): Make private fields in `CanonicalIter` concise.

7 months agofeat(chain): Signed txs should displace unsigned txs in `TxGraph`.
志宇 [Thu, 23 Jan 2025 01:41:04 +0000 (12:41 +1100)]
feat(chain): Signed txs should displace unsigned txs in `TxGraph`.

7 months agoMerge bitcoindevkit/bdk#1917: Canonicalization should handle transactions that spend...
merge-script [Wed, 23 Apr 2025 23:21:21 +0000 (09:21 +1000)]
Merge bitcoindevkit/bdk#1917: Canonicalization should handle transactions that spend from two conflicting transactions

370497c3a9c361e10c8341cbb07210f026cc3e04 fix(chain): Correctly handle txs that double spend themselves (志宇)

Pull request description:

  Fixes #1898

  ### Description

  When we initially created the canonicalization algorithm, we didn't expect callers to insert invalid transactions into the graph. However, user error happens and we should handle it correctly.

  Before this PR, when inserting transactions that double-spend themselves (where two or more different inputs of the transactions conflict), the canonicalization result will have inconsistencies.

  ### Notes to the reviewers

  Logic changes are all contained in `CanonicalIter::mark_canonical`. `mark_canonical` will detect whether the `tx` being passed in double spends itself. If so, we abort and undo all changes made so far.

  There is a slight <2% degradation in performance with this change (except in two cases where there is a performance improvement of ~10%).

  [bench.txt](https://github.com/user-attachments/files/19788730/bench.txt)

  ### Changelog notice

  * Fix canonicalization mess-up when transactions that conflict with itself are inserted.

  ### 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:
  ValuedMammal:
    ACK 370497c3a9c361e10c8341cbb07210f026cc3e04
  LagginTimes:
    ACK 370497c3a9c361e10c8341cbb07210f026cc3e04

Tree-SHA512: 41b08208b3ca7119ff10898c22f91b1fd41bb83876e4ca0655ece13b43db8cf3963a529286282c5fcd0e94d6ae073ffb30b19e91d28d8459957d5592bbacd3c9

8 months agofix(chain): Correctly handle txs that double spend themselves
志宇 [Fri, 28 Mar 2025 06:06:26 +0000 (17:06 +1100)]
fix(chain): Correctly handle txs that double spend themselves

Detect self-double-spends in `CanonicalIter::mark_canonical`. Disregard
the tx that self-double-spends and all it's attached meta data (such as
timestamps and anchors).

Add new test cases on `test_tx_conflict_handling` for transactions that
self-double-spend.

8 months agoMerge bitcoindevkit/bdk#1930: feat(chain): Add method for constructing TxGraph from...
merge-script [Thu, 10 Apr 2025 21:53:31 +0000 (07:53 +1000)]
Merge bitcoindevkit/bdk#1930: feat(chain): Add method for constructing TxGraph from a ChangeSet

f68cfa8afb7602d36a9b5c41552b2fc6de2c9ac2 feat(chain): Add method for constructing `TxGraph` from a `ChangeSet` (uvuvuwu)

Pull request description:

  ### Description
  * Added a `from_changeset()` function to `TxGraph` implementation
  * This function initializes a new `TxGraph` and applies the given `ChangeSet`
  * The method allows constructing a `TxGraph` directly from a `ChangeSet`,
    simplifying graph creation.

  #### 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:
  evanlinjin:
    ACK f68cfa8afb7602d36a9b5c41552b2fc6de2c9ac2
  LagginTimes:
    ACK f68cfa8afb7602d36a9b5c41552b2fc6de2c9ac2
  AmosOO7:
    ACK https://github.com/bitcoindevkit/bdk/commit/f68cfa8afb7602d36a9b5c41552b2fc6de2c9ac2

Tree-SHA512: 9301bb606cf131e0a9871fad0cfa5b50ccce810717672a68bc5c256bb643b75fa04682b3c22510194c4e278aa56fe467eeeee343ade50c47bfa2713c41a64abf

8 months agoMerge bitcoindevkit/bdk#1928: chore: remove bdk_wallet and update readme and ci workflow
merge-script [Thu, 10 Apr 2025 21:52:12 +0000 (07:52 +1000)]
Merge bitcoindevkit/bdk#1928: chore: remove bdk_wallet and update readme and ci workflow

1d7ad3122e74266e0833d7b590eb3f7bf3882655 chore: rename example-crates directory to examples (Steve Myers)
cddc0f2d7248feffc4b1279e7b8ac160b5bcb920 chore: remove bdk_wallet and update readme and ci workflow (Steve Myers)

Pull request description:

  ### Description

  Removes the `bdk_wallet` crate from the workspace of this repo now that it's been moved to it's own repo.

  ### Notes to the reviewers

  I did a bit of extra cleanup on the README file. I replaced the crates list with a table that also includes badges for the crate version and docs.  I also renamed the `example-crates` folder to simply `examples`, a nit of mine that I already fixed in the new `bdk_wallet` repo.

  See: bitcoindevkit/bdk_wallet#18

  ### Changelog notice

  For the changelog for the next version of `bdk_wallet`:

  - The `bdk_wallet` crate has been removed from the `bdk` repository and move to it's own `bdk_wallet` repository.

  ### 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 1d7ad3122e74266e0833d7b590eb3f7bf3882655
  ValuedMammal:
    ACK 1d7ad3122e74266e0833d7b590eb3f7bf3882655
  luisschwab:
    ACK 1d7ad3122e74266e0833d7b590eb3f7bf3882655
  LagginTimes:
    ACK 1d7ad3122e74266e0833d7b590eb3f7bf3882655
  AmosOO7:
    ACK 1d7ad31

Tree-SHA512: 6b2dab3220cb6642bd0ea7fbcb211ab24ce68c64d3752883d61791b8b7ecafe4fb6a6fb70436fc3bcd57ff3fc1ab5a98c05205292dd66425bddb66d13155c2a1

8 months agofeat(chain): Add method for constructing `TxGraph` from a `ChangeSet`
uvuvuwu [Sun, 6 Apr 2025 00:03:47 +0000 (12:03 +1200)]
feat(chain): Add method for constructing `TxGraph` from a `ChangeSet`

* Added a `from_changeset()` function to `TxGraph` implementation
* This function initializes a new `TxGraph` and applies the given `ChangeSet`
* The method allows constructing a `TxGraph` directly from a `ChangeSet`,
  simplifying graph creation.

8 months agochore: rename example-crates directory to examples
Steve Myers [Sat, 5 Apr 2025 01:31:47 +0000 (20:31 -0500)]
chore: rename example-crates directory to examples

8 months agochore: remove bdk_wallet and update readme and ci workflow
Steve Myers [Sat, 5 Apr 2025 01:22:52 +0000 (20:22 -0500)]
chore: remove bdk_wallet and update readme and ci workflow

8 months agoMerge bitcoindevkit/bdk#1925: chore: bump bdk_wallet to 1.2.0 file_store-0.19.0 wallet-1.2.0
valued mammal [Thu, 3 Apr 2025 13:45:14 +0000 (09:45 -0400)]
Merge bitcoindevkit/bdk#1925: chore: bump bdk_wallet to 1.2.0

d4ae72c2d3b0d955d711e7ba56ead41acf2a67bc chore: bump bdk_wallet to 1.2.0 (valued mammal)

Pull request description:

  Release `bdk_wallet` v1.2.0

  - bdk_file_store to 0.19.0

ACKs for top commit:
  LagginTimes:
    ACK d4ae72c2d3b0d955d711e7ba56ead41acf2a67bc

Tree-SHA512: 1817d5900f88e1bd38144c8c510b04fe597fa29ef28f86e751df8e540277e849d5f96cd6e770f62bc0ace70064b9e94724f55a704d69f0a3fbe0656eed580bf2

8 months agochore: bump bdk_wallet to 1.2.0
valued mammal [Thu, 3 Apr 2025 13:27:31 +0000 (09:27 -0400)]
chore: bump bdk_wallet to 1.2.0

- bdk_file_store to 0.19.0

8 months agoMerge bitcoindevkit/bdk#1924: chore: bump `miniscript` to `12.3.1`
valued mammal [Wed, 2 Apr 2025 19:01:06 +0000 (15:01 -0400)]
Merge bitcoindevkit/bdk#1924: chore: bump `miniscript` to `12.3.1`

f01de699785257ce5dd1c1ea53211ca947b66953 chore: bump `miniscript` to 12.3.1 (Wei Chen)

Pull request description:

  ### Description

  Bump `miniscript` dependency to `12.3.1`.

  ### Changelog notice

  * Updated `miniscript` dependency to `12.3.1`.

  ### Checklists

  #### All Submissions:

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

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

Tree-SHA512: 654f0c12d2626934572ea17c8f0b2042e75c7c7b6980d1628792f96830bbafefa05ec8b01e88941b5ce28c63a2a0c946225885253410fa26b1afecedd5a9fb87

8 months agochore: bump `miniscript` to 12.3.1
Wei Chen [Wed, 2 Apr 2025 06:09:38 +0000 (06:09 +0000)]
chore: bump `miniscript` to 12.3.1

9 months agoMerge bitcoindevkit/bdk#1840: example_cli: add feerate option to psbt new cmd
valued mammal [Thu, 20 Mar 2025 17:36:30 +0000 (13:36 -0400)]
Merge bitcoindevkit/bdk#1840: example_cli: add feerate option to psbt new cmd

c855a0942bafe1211308d887e8bc0de82c95cc68 refactor(example_cli): clean up CLI docs (valued mammal)
b9be1f43eeb4c822242962082de86ebd64f7410c deps(example_cli): bump `bdk_coin_select` to 0.4 (valued mammal)
3e640ff93d375a06678052befa45e6356949bff4 feat(example_cli): add feerate option to psbt new cmd (valued mammal)
1ab269e54881189b5f149d1941f804d780fd29d7 example_cli: fix collect assets with `for_each_key` (valued mammal)

Pull request description:

  The PR aims to add a `--feerate` option to the psbt `New` command.

  Also in this PR:

  - bump `bdk_coin_select` to 0.4
  - fix collecting `Assets` and enable support for more descriptor types

  ### Changelog notice

  ### Checklists

  #### All Submissions:

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

ACKs for top commit:
  ValuedMammal:
    ACK c855a0942bafe1211308d887e8bc0de82c95cc68

Tree-SHA512: f6a4d8d793c5258690bae397bcb3992e2c83ea21f0808e2d58c471d15aa160882873c336e71354e6c948aa9850cd62cfb53379365db79f98a9b1937a6abc2c7e

9 months agorefactor(example_cli): clean up CLI docs
valued mammal [Sun, 16 Feb 2025 15:35:31 +0000 (10:35 -0500)]
refactor(example_cli): clean up CLI docs

`--psbt` is a required arg for both Sign, Extract.

Change example_esplora --parallel-requests to 2 for easier
testing, debugging.

9 months agodeps(example_cli): bump `bdk_coin_select` to 0.4
valued mammal [Sun, 16 Feb 2025 14:41:21 +0000 (09:41 -0500)]
deps(example_cli): bump `bdk_coin_select` to 0.4

9 months agofeat(example_cli): add feerate option to psbt new cmd
valued mammal [Sun, 16 Feb 2025 14:40:41 +0000 (09:40 -0500)]
feat(example_cli): add feerate option to psbt new cmd

9 months agoexample_cli: fix collect assets with `for_each_key`
valued mammal [Thu, 6 Feb 2025 23:07:38 +0000 (18:07 -0500)]
example_cli: fix collect assets with `for_each_key`

which allows creating txs for more descriptor types.

9 months agoMerge bitcoindevkit/bdk#1890: ci: automated update to rustc 1.85.0
Steve Myers [Wed, 19 Mar 2025 02:49:18 +0000 (21:49 -0500)]
Merge bitcoindevkit/bdk#1890: ci: automated update to rustc 1.85.0

d23d6be02f10dcc24e19e5d595f40874b3f7667b ci: automated update to rustc 1.85.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:
  notmandatory:
    ACK d23d6be02f10dcc24e19e5d595f40874b3f7667b

Tree-SHA512: 572496e4606e05f0cf56ed7f17131170cae739cab9bd7dc163cefd3208ebd569554617db71ed7d0d7f2b74a05374e9480226a67e3a6701052f38795f343c84ba

9 months agoMerge bitcoindevkit/bdk#1896: ci: remove not needed nightly_docs workflow
Steve Myers [Wed, 19 Mar 2025 02:32:34 +0000 (21:32 -0500)]
Merge bitcoindevkit/bdk#1896: ci: remove not needed nightly_docs workflow

2cba47399da81c0101c307a27b290d83d420d180 ci: remove not needed nightly_docs workflow (Steve Myers)

Pull request description:

  ### Description

  I removed the nightly_docs workflow since it's not needed. The latest published bdk crate docs can be found on docs.rs.

  ### Notes to the reviewers

  We early in the project life we published nightly docs since the API was changing often and releases were infrequent. But now that the api is more stable and we make regular releases nightly docs aren't needed.

  ### 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:
  thunderbiscuit:
    ACK 2cba47399da81c0101c307a27b290d83d420d180.

Tree-SHA512: 69656d26bde1d357f823d0ba59deb4d27cee03888f578db4727f10c41086d51a4aaf592178c2467fddb95d8b80897dacc2e6824cd8a2e1d10b36ed7bbf567679

9 months agoci: remove not needed nightly_docs workflow
Steve Myers [Mon, 17 Mar 2025 20:00:55 +0000 (15:00 -0500)]
ci: remove not needed nightly_docs workflow

9 months agoMerge bitcoindevkit/bdk#1895: ci: fix publish_docs job fails with "permission denied"
Steve Myers [Mon, 17 Mar 2025 19:15:19 +0000 (14:15 -0500)]
Merge bitcoindevkit/bdk#1895: ci: fix publish_docs job fails with "permission denied"

8b0b3a4de54c5a592d9b385e1d99620960b05712 grant write permission to publish_docs (Musab1258)

Pull request description:

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

  ### Description

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

  The publish_docs workflow pushes changes to this repository: "bitcoindevkit/bitcoindevkit.org" which requires valid credentials. By setting the persist-credentials to false in #1778, the credentials required are not made available.

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

  To fix the issue I added a write permission to the publish_jobs, which will allow it to push changes without the credentials.

  ### Changelog notice

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

  ### Checklists

  #### All Submissions:

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

  #### New Features:

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

  #### Bugfixes:

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

ACKs for top commit:
  notmandatory:
    ACK 8b0b3a4de54c5a592d9b385e1d99620960b05712

Tree-SHA512: d72aaf79f99010b75f95404eadc61f0ce35f38cb9c24b0dcfc90dbe043affef06c477b6faa02dd488820c472bfc415993affdf67ebd55138dde0865e625ebf3d

9 months agoMerge bitcoindevkit/bdk#1885: ci: use `ubuntu-latest` on `check-wasm`
Steve Myers [Mon, 17 Mar 2025 18:53:52 +0000 (13:53 -0500)]
Merge bitcoindevkit/bdk#1885: ci: use `ubuntu-latest` on `check-wasm`

9710ecf1aafb50646f1ca2cd526644fb77393b6d fix(ci): use `ubuntu-latest` on `check-wasm` job (Luis Schwab)

Pull request description:

  ### Description

  This PR bumps the `check-wasm` job runner image to `ubuntu-24.04`. It was previously running `ubuntu-20.04`, which is set to be unsupported in a 3 weeks (see https://github.com/actions/runner-images/issues/11101); `clang` gets bumped to `clang-14` because of this.

  ### Checklists

  #### All Submissions:

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

ACKs for top commit:
  notmandatory:
    ACK 9710ecf1aafb50646f1ca2cd526644fb77393b6d

Tree-SHA512: 4ac8d6808211f26ab5ba4700edd70072f06c3623fbc3d33c17ee2679c68849fa9ce71f2c488c3ce45a4f814b04b946c8a909763898d7190984ff3486d16bcaef

9 months agogrant write permission to publish_docs
Musab1258 [Mon, 17 Mar 2025 04:12:42 +0000 (05:12 +0100)]
grant write permission to publish_docs

9 months agoMerge bitcoindevkit/bdk#1839: Introduce `evicted-at`/`last-evicted` timestamps
志宇 [Sat, 15 Mar 2025 23:04:12 +0000 (10:04 +1100)]
Merge bitcoindevkit/bdk#1839: Introduce `evicted-at`/`last-evicted` timestamps

0a20724e30316cbb68f7edf3f62028de15d26277 feat(examples): Update example crates to use `expected_spk_txids` (志宇)
1f8fc173b6aeddbc81a8301346502f9a923554ce feat(core)!: Remove redundant `SyncRequest` methods (志宇)
f42d5a8549df89452d57f1f9cff8f6e8e8c23dbc feat(esplora): Handle spks with expected txids (志宇)
3ab4994139dfa72d65ab0bbe6524af14efd77027 feat(electrum): Handle spks with expected txids (志宇)
64e4100a36f88a154b01706892fbec19edabf6b5 feat(chain): Add `TxGraph` methods that handle expected spk txids (志宇)
b38569fd147f8fe30f55e1c30cdba779247ba856 feat(core): Add expected txids to `SyncRequest` spks (Wei Chen)
a2dfcb9f9c39ef90f808b034731df0edb712e740 feat(chain)!: Change `TxGraph` to understand evicted-at & last-evicted (志宇)
ae0336b205f3b29253b5be3142dff54a4da09232 feat(core): Add `TxUpdate::evicted_ats` (志宇)

Pull request description:

  Partially Fixes #1740.
  Replaces #1765.
  Replaces #1811.

  ### Description

  This PR allows the receiving structures (`bdk_chain`, `bdk_wallet`) to detect and evict incoming transactions that are double spent (cancelled).

  We add a new field to `TxUpdate` (`TxUpdate::evicted_ats`), which in turn, updates the `last_evicted` timestamps that are tracked/persisted by `TxGraph`. This is similar to how `TxUpdate::seen_ats` update the `last_seen` timestamp in `TxGraph`. Transactions with a `last_evicted` timestamp higher than their `last_seen` timestamp are considered evicted.

  `SpkWithExpectedTxids` is introduced in `SpkClient` to track expected `Txid`s for each `spk`. During a sync, if any `Txid`s from `SpkWithExpectedTxids` are not in the current history of an `spk` obtained from the chain source, those `Txid`s are considered missing. Support for `SpkWithExpectedTxids` has been added to both `bdk_electrum` and `bdk_esplora` chain source crates.

  The canonicalization algorithm is updated to disregard transactions with a `last_evicted` timestamp greater than or equal to their `last_seen` timestamp, except in cases where transitivity rules apply.

  ### Notes to the reviewers

  This PR does not fix #1740 for block-by-block chain source (such as `bdk_bitcoind_rpc`). This work is done in a separate PR (#1857).

  ### Changelog notice

  * Add `TxUpdate::evicted_ats` which tracks transactions that have been replaced and are no longer present in mempool.
  * Change `TxGraph` to track `last_evicted` timestamps. This is when a transaction is last marked as missing from the mempool.
  * The canonicalization algorithm now disregards transactions with a `last_evicted` timestamp greater than or equal to it's `last_seen` timestamp, except when a canonical descendant exists due to rules of transitivity.
  * Add `SpkWithExpectedTxids` in `spk_client` which keeps track of expected `Txid`s for each `spk`.
  * Change `bdk_electrum` and `bdk_esplora` to understand `SpkWithExpectedTxids`.
  * Add `SyncRequestBuilder::expected_txids_of_spk` method which adds an association between `txid`s and `spk`s.

  ### 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:
  LLFourn:
    ACK 0a20724e30316cbb68f7edf3f62028de15d26277

Tree-SHA512: 29ef964e4597aa9f4cf02e9997b0d17cb91ec2f0f1187b0e9ade3709636b873c2a7cbe803facbc4686a3050a2abeb3e9cc40f9308f8cded9c9353734dcc5755b

9 months agoci: automated update to rustc 1.85.0
Github Action [Sat, 15 Mar 2025 01:06:01 +0000 (01:06 +0000)]
ci: automated update to rustc 1.85.0

9 months agofeat(examples): Update example crates to use `expected_spk_txids`
志宇 [Fri, 14 Mar 2025 01:17:57 +0000 (12:17 +1100)]
feat(examples): Update example crates to use `expected_spk_txids`

9 months agofeat(core)!: Remove redundant `SyncRequest` methods
志宇 [Fri, 14 Mar 2025 00:23:24 +0000 (11:23 +1100)]
feat(core)!: Remove redundant `SyncRequest` methods

Methods `next_spk` and `iter_spks` are removed. These are superceded
with `next_spk_with_expected_txids` and `iter_spks_with_expected_txids`.

9 months agofeat(esplora): Handle spks with expected txids
志宇 [Fri, 21 Feb 2025 10:36:17 +0000 (21:36 +1100)]
feat(esplora): Handle spks with expected txids

Also add `detect_receive_tx_cancel` test.
Also rm `miniscript` dependency.
Update ci to rm `miniscript/no-std` for `bdk_esplora`.

Co-authored-by: Wei Chen <wzc110@gmail.com>
9 months agofeat(electrum): Handle spks with expected txids
志宇 [Thu, 20 Feb 2025 12:21:10 +0000 (23:21 +1100)]
feat(electrum): Handle spks with expected txids

Co-authored-by: Wei Chen <wzc110@gmail.com>