]> Untitled Git - bdk/log
bdk
10 months agobuild(deps): bump Swatinem/rust-cache from 2.7.5 to 2.7.7 github/dependabot/github_actions/Swatinem/rust-cache-2.7.7
dependabot[bot] [Wed, 22 Jan 2025 02:55:46 +0000 (02:55 +0000)]
build(deps): bump Swatinem/rust-cache from 2.7.5 to 2.7.7

Bumps [Swatinem/rust-cache](https://github.com/swatinem/rust-cache) from 2.7.5 to 2.7.7.
- [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.5...v2.7.7)

---
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>
10 months agoMerge bitcoindevkit/bdk#1682: test(wallet): create tx locktime cltv for a specific...
valued mammal [Tue, 21 Jan 2025 22:58:12 +0000 (17:58 -0500)]
Merge bitcoindevkit/bdk#1682: test(wallet): create tx locktime cltv for a specific time

2c11d46d5c26f21fe564297f8766b888e1da3662 test(wallet): add check for a tx locktime cltv with timestamp (f3r10)

Pull request description:

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

  ### Description
  This PR adds a unit test that checks the satisfaction of timestamp-based timelocks. The goal is to test the absolute time therefore the variable passed to the miniscript fragment `after` has to be equal to or greater that 500_000_000 otherwise it would be checking the block height.

  ### 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 -->
  This unit test tries to check if #642 is still an issue.

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

Tree-SHA512: 081918b772b2a7e52b02bbf764e4204d9d5e18febded9e5600798c3f46d2e35a9a72ffeeca6c9bf708b71b8cf66d6e502771b2f8d15bfca2629a9dfbc67f6298

10 months agotest(wallet): add check for a tx locktime cltv with timestamp
f3r10 [Sat, 21 Dec 2024 21:00:34 +0000 (16:00 -0500)]
test(wallet): add check for a tx locktime cltv with timestamp

10 months agoMerge bitcoindevkit/bdk#1803: ci: add secondary MSRV job of 1.75.0
Steve Myers [Tue, 21 Jan 2025 20:09:12 +0000 (14:09 -0600)]
Merge bitcoindevkit/bdk#1803: ci: add secondary MSRV job of 1.75.0

c8b55da39913ddaf11d26f09d92034aef4f550e0 chore: fix punctuation and use `rustup override set` instead (Leonardo L.)
78bbfbe7210959b2c174c6c7e418bc975055a6ca ci: add `pin-msrv.sh` (valued mammal)
f7c9bc5166a508743ad11f116131a6f94d3e8e9e docs: update `README.md` with MSRV policy (valued mammal)
12eabd1ecd30bfed1d1329966029ea8c4cc34ac1 chore(cleanup): remove rustls from pinned deps (Leonardo Lima)
e3faeb63a07e4b8174de7cb521b54fae6f52779f ci: add secondary MSRV job of 1.75.0 (Leonardo Lima)

Pull request description:

  partially fixes #1750

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

  It adds a secondary MSRV version of `1.75.0` for the `bdk_electrum` crate, excluding it from the `1.63.0` MSRV dependency pinning and CI step.

  As it's the new CI will run without `bdk_electrum` for `1.63.0` MSRV step, will run another step for `1.75.0` MSRV and the latest stable.

  Currently,, the only affected crate is `electrum-client`, therefore `bdk-electrum`, as it relies directly on `rustls` which migrated to `1.71.0` MSRV. The `esplora-client` relies on `rustls` as a dependency of `minreq` or `reqwest`, but those crates didn't upgraded it's `rustls` versions yet.

  In a further PR it should also bump the `electrum-client` crate to it's latest version, which relies on `1.75.0` MSRV, see https://github.com/bitcoindevkit/rust-electrum-client/pull/159.

  ### Notes to the reviewers

  <!-- In this section you can include notes directed to the reviewers, like explaining why some parts
  of the PR were done in a specific way -->

  It's open for discussion if this approach is the expected one, or another one would be better.

  ### Changelog notice

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

  - Add a secondary MSRV of `1.75.0` for `bdk_electrum`.

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

Tree-SHA512: 186d82d6d295c688a608e1dd457e2718e0ae3ee92b7d1a0aad094711c3baeb70dccd581e3067e6305c1fc702c78f1704399f7472a5ae62824041ac68c384b770

10 months agochore: fix punctuation and use `rustup override set` instead
Leonardo L. [Tue, 21 Jan 2025 19:50:30 +0000 (16:50 -0300)]
chore: fix punctuation and use `rustup override set` instead

- fix some nits and punctuation typos.
- recommend usage of `rustup override set` instead of `rustup default` command.

Co-authored-by: Steve Myers <github@notmandatory.org>
10 months agoci: add `pin-msrv.sh`
valued mammal [Mon, 20 Jan 2025 16:37:40 +0000 (11:37 -0500)]
ci: add `pin-msrv.sh`

- add ci/pin-msrv.sh, which pins the dependencies for 1.63.0 MSRV

10 months agodocs: update `README.md` with MSRV policy
valued mammal [Fri, 17 Jan 2025 18:12:36 +0000 (13:12 -0500)]
docs: update `README.md` with MSRV policy

- bdk_electrum: add MSRV section to README.md

10 months agochore(cleanup): remove rustls from pinned deps
Leonardo Lima [Fri, 17 Jan 2025 00:05:13 +0000 (21:05 -0300)]
chore(cleanup): remove rustls from pinned deps

10 months agoci: add secondary MSRV job of 1.75.0
Leonardo Lima [Thu, 16 Jan 2025 23:08:04 +0000 (20:08 -0300)]
ci: add secondary MSRV job of 1.75.0

10 months agoMerge bitcoindevkit/bdk#1801: ci: automated update to rustc 1.84.0
Steve Myers [Tue, 21 Jan 2025 19:19:34 +0000 (13:19 -0600)]
Merge bitcoindevkit/bdk#1801: ci: automated update to rustc 1.84.0

1ccc29e7153c87a4cd4dc5c599ff8ff4ccf23a57 ci(clippy): fix new stricter needless_lifetime errors for rust 1.84 (Steve Myers)
49a616d2ead3299db19fba3523feb1f6424a4d4c ci: automated update to rustc 1.84.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 1ccc29e7
  oleonardolima:
    ACK 1ccc29e7153c87a4cd4dc5c599ff8ff4ccf23a57

Tree-SHA512: 8985c389189d6bd5012eef581d35dafe953932b3d87a10ccc327397ff4741af1b20425a2de958da90779f7000f6d349122ff39241657a67eb46a2c93799d3491

10 months agoci(clippy): fix new stricter needless_lifetime errors for rust 1.84
Steve Myers [Tue, 21 Jan 2025 18:59:04 +0000 (12:59 -0600)]
ci(clippy): fix new stricter needless_lifetime errors for rust 1.84

https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes

10 months agoci: automated update to rustc 1.84.0
Github Action [Wed, 15 Jan 2025 01:03:09 +0000 (01:03 +0000)]
ci: automated update to rustc 1.84.0

10 months agoMerge bitcoindevkit/bdk#1685: test(electrum): test for checking that fee calculation...
valued mammal [Tue, 21 Jan 2025 16:54:50 +0000 (11:54 -0500)]
Merge bitcoindevkit/bdk#1685: test(electrum): test for checking that fee calculation is correct

f429973111c7fb21304f268b70c55d2d4f08eb2b test(electrum): test for checking that fee calculation is correct (f3r10)

Pull request description:

  ### Description

  This PR adds a unit test for checking that the fee calculation of `bdk_electrum` is correct.

  > a "preliminary" tx to an address in Core's wallet such that the output created becomes the input of the next tx. This preliminary tx is the prev_tx that needs to be fetched in order to calculate the fee of the tx sent to the receiver. This way is better because the required outpoint is less determined. Then we assert we have the right (outpoint, txout) in the update TxGraph  https://github.com/bitcoindevkit/bdk/issues/1444#issuecomment-2112751282

  ### Notes to the reviewers

  fixes: #1444

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

Tree-SHA512: f1f541989ea4c8a90c4ab40b3599bae7aef1fe10dd17d027d7c84dac561c208c5d4de06d0048c7f74b6f39f48000cdb1ead6dadc8d54b29f6608fb29dba8ab34

10 months agotest(electrum): test for checking that fee calculation is correct
f3r10 [Wed, 18 Dec 2024 15:25:02 +0000 (10:25 -0500)]
test(electrum): test for checking that fee calculation is correct

11 months agoMerge bitcoindevkit/bdk#1802: ci: pin `rustls` for msrv
valued mammal [Thu, 16 Jan 2025 13:08:57 +0000 (08:08 -0500)]
Merge bitcoindevkit/bdk#1802: ci: pin `rustls` for msrv

e4cf5b5b3d8ea349c785d524634f0cca49ec5935 ci: pin `rustls` for msrv (valued mammal)

Pull request description:

  Fix the current CI issue by pinning `rustls` again to 0.23.19

ACKs for top commit:
  oleonardolima:
    tACK e4cf5b5b3d8ea349c785d524634f0cca49ec5935

Tree-SHA512: b67876a941994defc56e43260c1126e9948312ba9bc9363fb0a8b7a556faad4a8f5940ca5d87b56c4278e3664ca3ab67c73f3a4e9e7dc656adcad07a90cbcd24

11 months agoci: pin `rustls` for msrv
valued mammal [Wed, 15 Jan 2025 01:42:05 +0000 (20:42 -0500)]
ci: pin `rustls` for msrv

11 months agoMerge bitcoindevkit/bdk#1789: Change default tx to version 2
Steve Myers [Fri, 10 Jan 2025 15:39:51 +0000 (09:39 -0600)]
Merge bitcoindevkit/bdk#1789: Change default tx to version 2

2219b7cd55bfb8023e9b426de0ef118b32bfa372 fix(tx_builder): change default tx to version 2 (benalleng)

Pull request description:

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

  ### Description

  Changes the default version number to version 2 to enchance privacy for the type of wallet used

  Fixes #1676

  ### Changelog notice

  - Changed the default transaction version number in the transaction builder.
  - Updated the test to test for the default transaction number.

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

Tree-SHA512: 76a2d394318eea94a99c033c3df14d64dbcf96c0f91dba91d2e337b9ecf78302af3d535ab11a74ed7372a521d3bc14c3455b7c8266d79d2995cc7c5da363b426

11 months agoMerge bitcoindevkit/bdk#1790: fix(wallet): improve safety on finaize psbt
志宇 [Fri, 10 Jan 2025 05:33:35 +0000 (16:33 +1100)]
Merge bitcoindevkit/bdk#1790: fix(wallet): improve safety on finaize psbt

e8a96389bac78961220cbc095c820a551ce4dacf fix(wallet): improve safety on finaize psbt (f3r10)

Pull request description:

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

  This PR replaces how currently potentially bug-prone PSBT's input access is done using a more carefully approach.

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

ACKs for top commit:
  rustaceanrob:
    ACK e8a96389bac78961220cbc095c820a551ce4dacf
  evanlinjin:
    ACK e8a96389bac78961220cbc095c820a551ce4dacf

Tree-SHA512: ad25a9d5d47cbdc41b11ea4ce57b30c6855ea391c0f053dffbee0c3dd1b06c6b227e056ede69eee6026e8b72915fe06c366d0a4e2fd6a1d454fc8dafed80b74a

11 months agofix(tx_builder): change default tx to version 2
benalleng [Thu, 2 Jan 2025 17:09:15 +0000 (12:09 -0500)]
fix(tx_builder): change default tx to version 2

This change improves privacy since >85% of transactions on the network are version 2. Version 2 is also necessary to eventually implement BIP 326 nSequence-based anti-fee-sniping.

11 months agofix(wallet): improve safety on finaize psbt
f3r10 [Sun, 5 Jan 2025 17:55:49 +0000 (12:55 -0500)]
fix(wallet): improve safety on finaize psbt

11 months agoMerge bitcoindevkit/bdk#1592: Architectural Decision Records
valued mammal [Fri, 3 Jan 2025 19:37:27 +0000 (14:37 -0500)]
Merge bitcoindevkit/bdk#1592: Architectural Decision Records

3b10abbef69a2245714a762a555ff58a67217eec docs: add ADR 0002_persisted.md (valued mammal)
1c4b24469a971fdb2490b7358b10f9c480a7c16a docs: add ADR 0001_persist.md (valued mammal)
e60c65b484fb8a3754b206b97cc3ef4a4d2f6334 docs: add architectural decision record (ADR) template (valued mammal)

Pull request description:

  Opening this up as a record of past decisions. The template is inspired by the one used by uniffi. Whether or not we decide to add these to the repo, it's an opportunity to learn, discuss, and collab when it comes to design and architecture.

  The first 2 ADRs pertain to bdk's approach to data persistence. Another recent suggestion was to document how we're thinking about single vs multiple descriptor wallets. Feedback welcome.

  fixes #1309

ACKs for top commit:
  thunderbiscuit:
    ACK 3b10abbef69a2245714a762a555ff58a67217eec.

Tree-SHA512: 9eeed764a21805b00189320efa6266fd77c333e530295df8b3bab7d97400a8658db712a0c4b17ea056355f5ff2c110f74e0e384b85a71489bbba1fce1a19b7d4

11 months agodocs: add ADR 0002_persisted.md
valued mammal [Thu, 5 Sep 2024 22:34:13 +0000 (18:34 -0400)]
docs: add ADR 0002_persisted.md

11 months agodocs: add ADR 0001_persist.md
valued mammal [Thu, 5 Sep 2024 22:25:09 +0000 (18:25 -0400)]
docs: add ADR 0001_persist.md

11 months agodocs: add architectural decision record (ADR) template
valued mammal [Thu, 5 Sep 2024 22:23:59 +0000 (18:23 -0400)]
docs: add architectural decision record (ADR) template

11 months agoMerge bitcoindevkit/bdk#1768: refactor(wallet): cleanup and remove unused code in...
Steve Myers [Mon, 23 Dec 2024 19:56:03 +0000 (13:56 -0600)]
Merge bitcoindevkit/bdk#1768: refactor(wallet): cleanup and remove unused code in create_tx

a2f7a8be149e4a420519dbe072927faeb7f92514 refactor(wallet): cleanup and remove unused code in create_tx (Steve Myers)

Pull request description:

  ### Description

  Cleanup and remove unused code in `Wallet::create_tx`, this was noticed during review of #1763. See: https://github.com/bitcoindevkit/bdk/pull/1763#discussion_r1876740140

  fixes #1710

  ### Notes to the reviewers

  In addition to removing the unneeded assignments to `fee_amount` and `received` I also refactored creation of the change output to be an `if let` instead of `match` statement since it only needs to do something if there is `Excess::Change`.

  I should have done this cleanup as part of #1048.

  ### Changelog notice

  None, only internal cleanup.

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

Tree-SHA512: 64e5895ff3dc11f71c48b6c436d5c812504d0a24e92f1fdf451936f372d95ccdd8d89e5ac634a041bdee0a4836182f05127864ed744d560c9f8ec560e092c559

11 months agorefactor(wallet): cleanup and remove unused code in create_tx
Steve Myers [Mon, 9 Dec 2024 23:56:49 +0000 (17:56 -0600)]
refactor(wallet): cleanup and remove unused code in create_tx

11 months agoMerge bitcoindevkit/bdk#1785: test(wallet): small cleanups to test_wallet_transaction...
valued mammal [Mon, 23 Dec 2024 14:20:34 +0000 (09:20 -0500)]
Merge bitcoindevkit/bdk#1785: test(wallet): small cleanups to test_wallet_transactions_relevant

63465361ac524cc9af16b5a1b092bf5457a07f87 test(wallet): small cleanups to test_wallet_transactions_relevant (Steve Myers)

Pull request description:

  ### Description

  This cleans up the `test_wallet_transactions_relevant` test based on suggestions that didn't make it into #1779.

  ### Notes to the reviewers

  Also included a small use cleanup in wallet/mod.

  ### Changelog notice

  None.

  ### Checklists

  #### All Submissions:

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

ACKs for top commit:
  luisschwab:
    ACK 63465361ac524cc9af16b5a1b092bf5457a07f87
  ValuedMammal:
    ACK 63465361ac524cc9af16b5a1b092bf5457a07f87

Tree-SHA512: f9604518d2b9bb5614385a053efb03d53311f359626d45270f3648209ab0e31ba966995f842fff1c35f0c83848c61f0976f91524a3f457c6cd85e3f0929f4a77

11 months agotest(wallet): small cleanups to test_wallet_transactions_relevant
Steve Myers [Fri, 20 Dec 2024 20:40:55 +0000 (14:40 -0600)]
test(wallet): small cleanups to test_wallet_transactions_relevant

Also small use cleanup in wallet/mod.

12 months agoBump bdk_wallet version to 1.0.0 bitcoind_rpc-0.17.1 chain-0.21.1 core-0.4.1 electrum-0.20.1 esplora-0.20.1 file_store-0.18.1 testenv-0.11.1 wallet-1.0.0
Steve Myers [Thu, 19 Dec 2024 03:55:18 +0000 (21:55 -0600)]
Bump bdk_wallet version to 1.0.0

bdk_core to 0.4.1
bdk_chain to 0.21.1
bdk_bitcoind_rpc to 0.17.1
bdk_electrum to 0.20.1
bdk_esplora to 0.20.1
bdk_file_store to 0.18.1
bdk_testenv to 0.11.1

Create CHANGELOG.md files for all crates.

12 months agoMerge bitcoindevkit/bdk#1779: `transactions` method should only return relevant trans...
Steve Myers [Wed, 18 Dec 2024 15:25:54 +0000 (09:25 -0600)]
Merge bitcoindevkit/bdk#1779: `transactions` method should only return relevant transactions

75fae3ef56be838787306fc81862eb5ae500f635 test(wallet): verify Wallet::transactions method only returns relevant txs (Steve Myers)
3e1fd2b0a2b39668e5ab29c6968e85949623e447 fix(wallet): `transactions` method should only return relevant txs (志宇)

Pull request description:

  Fixes #1239

  ### Description

  Currently the behavior of `Wallet::transactions` is not well defined and unintuitive.

  The approach taken in this PR is to make `Wallet::transactions` return what most wallets would like the caller to see (i.e. transactions that are part of the canonical history and spend from/to a tracked spk). A.k.a make the method more restrictive.

  Documentation is updated to refer the caller to the underlying `bdk_chain` structures for any over usecase.

  After #1765 gets merged, the behavior of `Wallet::transactions` will become even more unintuitive. Refer to https://github.com/bitcoindevkit/bdk/pull/1765#pullrequestreview-2503968540.

  ### Notes to the reviewers

  **Why not have multiple methods in `Wallet` that return different sets of transactions?**

  I think it's better to only provide common usecase histories from `Wallet` and I can only think of one.

  ### Changelog notice

  * Change `Wallet::transactions` to only include "relevant" transactions.

  ### Checklists

  #### All Submissions:

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

ACKs for top commit:
  luisschwab:
    tACK 75fae3ef56be838787306fc81862eb5ae500f635
  notmandatory:
    tACK 75fae3ef56be838787306fc81862eb5ae500f635
  oleonardolima:
    tACK 75fae3ef56be838787306fc81862eb5ae500f635
  ValuedMammal:
    ACK 75fae3ef

Tree-SHA512: abf159e0c5d44842d7e0fc5ebc6829d34646fbc45d07bb145ce327f368db0e571ab7c5731a12e63258dfc74abb9d4ff1b841842de8341e0f21b5cbb2becc5e5f

12 months agotest(wallet): verify Wallet::transactions method only returns relevant txs
Steve Myers [Tue, 17 Dec 2024 22:10:54 +0000 (16:10 -0600)]
test(wallet): verify Wallet::transactions method only returns relevant txs

12 months agofix(wallet): `transactions` method should only return relevant txs
志宇 [Tue, 17 Dec 2024 02:46:58 +0000 (13:46 +1100)]
fix(wallet): `transactions` method should only return relevant txs

Also update documentation.

12 months agoMerge bitcoindevkit/bdk#1776: ci: automated update to rustc 1.83.0
Steve Myers [Tue, 17 Dec 2024 20:28:27 +0000 (14:28 -0600)]
Merge bitcoindevkit/bdk#1776: ci: automated update to rustc 1.83.0

272ce227b40da4990821baee239f1a227d79e4d8 ci: update build_docs job to use rust nightly (Steve Myers)
1755480d3ca87c2bff98035adc008d2d6a570ccc ci: use prepared rust-version instead of stable for all jobs (Steve Myers)
173cc42d00748e95df889fd487b5bebf458109d6 ci(clippy): fix updated ptr_arg check for rust 1.83 (Steve Myers)
1d03db9ab37bfe623e16bc85f712d4a1db4c51ed ci(clippy): fix new default warn empty_line_after_doc_comments for rust 1.83 (Steve Myers)
941bca0d405f86e748ea629a2e241bffa41108f8 ci(clippy): fix new stricter needless_lifetime errors for rust 1.83 (Steve Myers)
2586e1eb9fbdf583460e25e80324251b0cf3f60c ci: automated update to rustc 1.83.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

  I manually fixed new clippy warnings.

  I also changed CI to:
  ~~1. not build or run tests or test dependencies when building with MSRV.  This reduced the number of dependencies we need to pin for MSRV and fixes 1398.~~ I removed these changes.
  2. use the same version or rust as in the `rust-version` file for all jobs instead of just for clippy. I made this change to prevent CI breaks when stable changes before we have a chance to fix the auto created PR that bumps the `rust-version` file.

ACKs for top commit:
  oleonardolima:
    tACK 272ce227b40da4990821baee239f1a227d79e4d8
  nymius:
    tACK 272ce227b40da4990821baee239f1a227d79e4d8
  ValuedMammal:
    ACK 272ce227b40da4990821baee239f1a227d79e4d8

Tree-SHA512: de3e9447e25f82474cd6902ade9dfad4145686b4084296d3fd2065e28bf811579bbaa18225d175372e7dd9914377c6e8260998ff991b0f482f19551884bbf9ca

12 months agoci: update build_docs job to use rust nightly
Steve Myers [Tue, 17 Dec 2024 02:12:27 +0000 (20:12 -0600)]
ci: update build_docs job to use rust nightly

12 months agoci: use prepared rust-version instead of stable for all jobs
Steve Myers [Mon, 16 Dec 2024 03:47:12 +0000 (21:47 -0600)]
ci: use prepared rust-version instead of stable for all jobs

12 months agoci(clippy): fix updated ptr_arg check for rust 1.83
Steve Myers [Mon, 16 Dec 2024 01:35:58 +0000 (19:35 -0600)]
ci(clippy): fix updated ptr_arg check for rust 1.83

https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
https://github.com/rust-lang/rust-clippy/pull/13313

12 months agoci(clippy): fix new default warn empty_line_after_doc_comments for rust 1.83
Steve Myers [Mon, 16 Dec 2024 01:25:05 +0000 (19:25 -0600)]
ci(clippy): fix new default warn empty_line_after_doc_comments for rust 1.83

https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments
https://github.com/rust-lang/rust-clippy/pull/13091

12 months agoci(clippy): fix new stricter needless_lifetime errors for rust 1.83
Steve Myers [Mon, 16 Dec 2024 01:15:52 +0000 (19:15 -0600)]
ci(clippy): fix new stricter needless_lifetime errors for rust 1.83

https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
https://github.com/rust-lang/rust-clippy/pull/13286

12 months agoci: automated update to rustc 1.83.0
Github Action [Sun, 15 Dec 2024 01:15:04 +0000 (01:15 +0000)]
ci: automated update to rustc 1.83.0

12 months agoMerge bitcoindevkit/bdk#1774: chore[chain,wallet]: fix build warnings
Steve Myers [Fri, 13 Dec 2024 21:05:08 +0000 (15:05 -0600)]
Merge bitcoindevkit/bdk#1774: chore[chain,wallet]: fix build warnings

479117c2071a9062438e3b94c2c6cf70ff6fb3c0 chore(chain,wallet): fix build warnings (Steve Myers)

Pull request description:

  ### Description

  fixed #1773

  ### Notes to the reviewers

  I noticed these warnings while publishing beta.6 and would like to get them fixed before the final `bdk_wallet` 1.0.0. With default features we should have any build warnings. To reproduce:

  ```
  cargo build -p bdk_chain
  cargo build -p bdk_wallet
  ```

  ### Checklists

  #### All Submissions:

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

ACKs for top commit:
  ValuedMammal:
    ACK 479117c2071a9062438e3b94c2c6cf70ff6fb3c0

Tree-SHA512: d9b18f0472ed3a3088c24f46b49361154dd568d95045bee6108a7f6ace84d0da19cfe1079b8549a5ba723e0ded9bca502f0ebf2d557ff4f23ac87ee51e6c335a

12 months agoMerge bitcoindevkit/bdk#1680: docs(wallet): reword the `next_unused_address` doc
Steve Myers [Fri, 13 Dec 2024 15:24:33 +0000 (09:24 -0600)]
Merge bitcoindevkit/bdk#1680: docs(wallet): reword the `next_unused_address` doc

b39cf08c98d9a5b53bb0eacd53c71c341ba37f76 docs(wallet): reword the `next_unused_address` doc (Leonardo Lima)

Pull request description:

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

  ### Description

  Adds an example on what `used` stands for, and make it explicit that it
  has the same behavior as `Wallet::reveal_next_address` in the scenario
  where all previously revealed addresses have been used.

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

  ### Notes to the reviewers

  Is there any other behavior of `next_unused_address` we'd need to make clear through documentation ?

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

  - Improve the `Wallet::next_unused_address` documentation to better describe expected behavior/usage.

  ### 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 b39cf08c98d9a5b53bb0eacd53c71c341ba37f76
  ValuedMammal:
    ACK b39cf08c98d9a5b53bb0eacd53c71c341ba37f76

Tree-SHA512: af4e912db9b3283527c00ed91a72c1c01f1dd6d8889cf345c6347e77152f7e3aadc93c7040e4283411e078b3394fb46f1b4d7f6f872f39d2219e03f242ee1130

12 months agodocs(wallet): reword the `next_unused_address` doc
Leonardo Lima [Wed, 4 Dec 2024 18:33:45 +0000 (15:33 -0300)]
docs(wallet): reword the `next_unused_address` doc

docs(wallet): reword the `next_unused_address` doc

Adds an example on what `used` stands for, and make it explicit that it
has the same behavior as `Wallet::reveal_next_address` in the scenario
where all previously revealed addresses have been used.

docs(wallet): fix typo in doc comment

12 months agochore(chain,wallet): fix build warnings
Steve Myers [Thu, 12 Dec 2024 04:35:04 +0000 (22:35 -0600)]
chore(chain,wallet): fix build warnings

12 months agoBump bdk_wallet version to 1.0.0-beta.6 v1.0.0-beta.6
Steve Myers [Thu, 12 Dec 2024 00:45:01 +0000 (18:45 -0600)]
Bump bdk_wallet version to 1.0.0-beta.6

bdk_core to 0.4.0
bdk_chain to 0.21.0
bdk_bitcoind_rpc to 0.17.0
bdk_electrum to 0.20.0
bdk_esplora to 0.20.0
bdk_file_store to 0.18.0
bdk_testenv to 0.11.0

12 months agoMerge bitcoindevkit/bdk#1763: Change coin_selection and DescriptorExt::dust_value...
Steve Myers [Wed, 11 Dec 2024 21:21:29 +0000 (15:21 -0600)]
Merge bitcoindevkit/bdk#1763: Change coin_selection and DescriptorExt::dust_value to use Amount type

2a9eeed302a3c7faaa7e2d26ff3d806f2317a850 ci: pin msrv dep version for rustls (Steve Myers)
20789ec9e833ad8d24608201960789614dfae52b refactor(chain)!: use Amount for DescriptorExt::dust_value() (Steve Myers)
58a8435759ed06cb6841c5582abd97707e99706b refactor(coin_selection)!: use Amount and SignedAmount for API and internally (Steve Myers)

Pull request description:

  ### Description

  refactor(coin_selection)!: use Amount and SignedAmount for API and internally
  refactor(chain)!: use Amount for DescriptorExt::dust_value()

  Using named types make the API and internal code easier to read and reason about since it makes it clear that the values are bitcoin amounts. Also to create these types the units (ie .from_sat()) must be specified.

  ### Notes to the reviewers

  For coin_selection using Amount and SignedAmount makes internal code safer against overflow errors. In particular because these types will panic if an amount overflow occurs. Using u64/i64 on the other hand can silently rollover. See: https://doc.rust-lang.org/book/ch03-02-data-types.html#integer-overflow

  This is a continuation of the work done in #1595.  Since this is an API breaking change I would like to include it in the 1.0.0-beta milestone if possible.

  ### Changelog notice

  - Change coin_selection to use Amount instead of u64 for all bitcoin amounts.
  - Change DescriptorExt::dust_value() to return an Amount instead of u64.

  ### Checklists

  #### All Submissions:

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

  #### Bugfixes:

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

ACKs for top commit:
  ValuedMammal:
    ACK 2a9eeed302a3c7faaa7e2d26ff3d806f2317a850

Tree-SHA512: 9dd1b31d0f8d3d8c383c7aae7ec0fffb55bfcfe49c804e273faa740d30efde7efb7c9504e87cceb56798ea14a3e34fc8a7b65a8ad5e52ea38b8523150c9b6bc2

12 months agoci: pin msrv dep version for rustls
Steve Myers [Wed, 11 Dec 2024 20:59:22 +0000 (14:59 -0600)]
ci: pin msrv dep version for rustls

12 months agorefactor(chain)!: use Amount for DescriptorExt::dust_value()
Steve Myers [Sun, 8 Dec 2024 02:24:35 +0000 (20:24 -0600)]
refactor(chain)!: use Amount for DescriptorExt::dust_value()

12 months agorefactor(coin_selection)!: use Amount and SignedAmount for API and internally
Steve Myers [Sun, 8 Dec 2024 01:28:24 +0000 (19:28 -0600)]
refactor(coin_selection)!: use Amount and SignedAmount for API and internally

Using named types make the API and internal code easier to read and reason
about since it makes it clear that the values are bitcoin amounts. Also to
create these types the units (ie .from_sat()) must be specified.

Using Amount and SignedAmount also makes internal code safer against overflow
errors. In particular because these types will panic if an amount overflow
occurs. Using u64/i64 on the otherhand can silently rollover. See:
https://doc.rust-lang.org/book/ch03-02-data-types.html#integer-overflow

12 months agoMerge bitcoindevkit/bdk#1670: Introduce `O(n)` canonicalization algorithm
志宇 [Wed, 11 Dec 2024 05:47:01 +0000 (16:47 +1100)]
Merge bitcoindevkit/bdk#1670: Introduce `O(n)` canonicalization algorithm

956d0a93bab36fd919e81718832fbc1033b677e9 test(chain): Update test docs to stop referencing `get_chain_position` (志宇)
1508ae3db4b0595e61136d4d28e10777c92a7273 chore: Fix typos (志宇)
af92199b69642d60aec509b246b2252c6a41d220 refactor(wallet): Reuse chain position instead of obtaining new one (Jiri Jakes)
caa0f13d40d000229dd867e6c52039a0c897fed2 docs(wallet): Explain `.take` usage (志宇)
1196405904acdaa2287e4edc0cc71a71cc9790cc refactor(chain): Reorganize `TxGraph::insert_anchor` logic for clarity (志宇)
4706315e8f60a7d308184aa028f51741b47219a7 chore(chain): Address `CanonicalIter` nitpicks (志宇)
68f7b7724388eb104775a256b3529198e5af84b7 test(chain): Add canonicalization test (志宇)
da0c43ed94b6cc0ecc8ac4f04880fd01a28d244c refactor(chain)!: Rename `LastSeenIn` to `ObservedIn` (志宇)
d4102b4b6bb885934a3bfd8efffeb550541efe7f perf(chain): add benchmarks for canonicalization logic (志宇)
e34024cd566cd4dc17ab90cc5b191da8e55802e5 feat(chain): Derive `Clone` on `IndexedTxGraph` (志宇)
e9854455ca77875a6ff79047726064ba42f94f29 docs: Add ADR for `O(n)` canonicalization algorithm (志宇)
4325e2c25e037129c7878f347dd32cc48b771bb3 test(chain): Add transitive anchor tests (志宇)
8fbee12b1c24ec0004fda40eaf9330a87a7f4161 feat(chain)!: rm `get_chain_position` and associated methods (志宇)
582d6b51f865d98077d72422d15630a2a3c7d16e feat(chain)!: `O(n)` canonicalization algorithm (志宇)
f6192a615a7aea2ca9bdcca199356ea4d0386ce1 feat(chain)!: Add `run_until_finished` methods (志宇)
0aa39f9e1ca406c55a1e33477ec3806c7cf8b9b5 feat(chain)!: `TxGraph` contain anchors in one field (志宇)

Pull request description:

  Fixes #1665
  Replaces #1659

  ### Description

  Previously, getting the canonical history of transactions/UTXOs required calling `TxGraph::get_chain_position` on each transaction. This was highly inefficient and resulted in an `O(n^2)` algorithm. The situation is especially problematic when we have many unconfirmed conflicts.

  This PR introduces an `O(n)` algorithm to determine the canonical set of transactions in `TxGraph`. The algorithm's premise is as follows:

  1. If transaction `A` is determined to be canonical, all of `A`'s ancestors must also be canonical.
  2. If transaction `B` is determined to be NOT canonical, all of `B`'s descendants must also be NOT canonical.
  3. If a transaction is anchored in the best chain, it is canonical.
  4. If a transaction conflicts with a canonical transaction, it is NOT canonical.
  5. A transaction with a higher last-seen has precedence.
  6. Last-seen values are transitive. A transaction's collective last-seen value is the max of it's last-seen value and all of it's descendants.

  We maintain two mutually-exclusive `txid` sets: `canoncial` and `not_canonical`.

  Imagine a method `mark_canonical(A)` that is based on premise 1 and 2. This method will mark transaction `A` and all of it's ancestors as canonical. For each transaction that is marked canonical, we can iterate all of it's conflicts and mark those as `non_canonical`. If a transaction already exists in `canoncial` or `not_canonical`, we can break early, avoiding duplicate work.

  This algorithm iterates transactions in 3 runs.

  1. Iterate over all transactions with anchors in descending anchor-height order. For any transaction that has an anchor pointing to the best chain, we call `mark_canonical` on it. We iterate in descending-height order to reduce the number of anchors we need to check against the `ChainOracle` (premise 1). The purpose of this run is to populate `non_canonical` with all transactions that directly conflict with anchored transactions and populate `canonical` with all anchored transactions and ancestors of anchors transactions (transitive anchors).
  2. Iterate over all transactions with last-seen values, in descending last-seen order. We can call `mark_canonical` on all of these that do not already exist in `canonical` or `not_canonical`.
  3. Iterate over remaining transactions that contains anchors (but not in the best chain) and have no last-seen value. We treat these transactions in the same way as we do in run 2.

  #### Benchmarks

  Thank you to @ValuedMammal for working on this.

  ```sh
  $ cargo bench -p bdk_chain --bench canonicalization
  ```

  Benchmark results (this PR):

  ```
  many_conflicting_unconfirmed::list_canonical_txs
                          time:   [709.46 us 710.36 us 711.35 us]
  many_conflicting_unconfirmed::filter_chain_txouts
                          time:   [712.59 us 713.23 us 713.90 us]
  many_conflicting_unconfirmed::filter_chain_unspents
                          time:   [709.95 us 711.16 us 712.45 us]
  many_chained_unconfirmed::list_canonical_txs
                          time:   [2.2604 ms 2.2641 ms 2.2680 ms]
  many_chained_unconfirmed::filter_chain_txouts
                          time:   [3.5763 ms 3.5869 ms 3.5979 ms]
  many_chained_unconfirmed::filter_chain_unspents
                          time:   [3.5540 ms 3.5596 ms 3.5652 ms]
  nested_conflicts_unconfirmed::list_canonical_txs
                          time:   [660.06 us 661.75 us 663.60 us]
  nested_conflicts_unconfirmed::filter_chain_txouts
                          time:   [650.15 us 651.36 us 652.71 us]
  nested_conflicts_unconfirmed::filter_chain_unspents
                          time:   [658.37 us 661.54 us 664.81 us]
  ```

  Benchmark results (master): https://github.com/evanlinjin/bdk/tree/fix/1665-master-bench

  ```
  many_conflicting_unconfirmed::list_canonical_txs
                          time:   [94.618 ms 94.966 ms 95.338 ms]
  many_conflicting_unconfirmed::filter_chain_txouts
                          time:   [159.31 ms 159.76 ms 160.22 ms]
  many_conflicting_unconfirmed::filter_chain_unspents
                          time:   [163.29 ms 163.61 ms 163.96 ms]

  # I gave up running the rest of the benchmarks since they were taking too long.
  ```

  ### Notes to the reviewers

  * ***PLEASE MERGE #1733 BEFORE THIS PR!*** We had to change the signature of `ChainPosition` to account for transitive anchors and unconfirmed transactions with no `last-seen` value.

  * The canonicalization algorithm is contained in `/crates/chain/src/canonical_iter.rs`.

  * Since the algorithm requires traversing transactions ordered by anchor height, and then last-seen values, we introduce two index fields in `TxGraph`; `txs_by_anchor` and `txs_by_last_seen`. Methods `insert_anchor` and `insert_seen_at` are changed to populate these index fields.

  * An ADR is added: `docs/adr/0003_canonicalization_algorithm.md`. This is based on the work in #1592.

  ### Changelog notice

  * Added: Introduce an `O(n)` canonicalization algorithm. This logic is contained in `/crates/chain/src/canonical_iter.rs`.
  * Added: Indexing fields in `TxGraph`; `txs_by_anchor_height` and `txs_by_last_seen`. Pre-indexing allows us to construct the canonical history more efficiently.
  * Removed: `TxGraph` methods: `try_get_chain_position` and `get_chain_position`. This is superseded by the new canonicalization algorithm.

  ### 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 956d0a93bab36fd919e81718832fbc1033b677e9
  nymius:
    ACK 956d0a93
  oleonardolima:
    utACK 956d0a93bab36fd919e81718832fbc1033b677e9
  jirijakes:
    ACK 956d0a93bab36fd919e81718832fbc1033b677e9

Tree-SHA512: 44963224abf1aefb3510c59d0eb27e3a572cd16f46106fd92e8da2e6e12f0671dcc1cd5ffdc4cc80683bc9e89fa990eba044d9c64d9ce02abc29a08f4859b69e

12 months agotest(chain): Update test docs to stop referencing `get_chain_position`
志宇 [Tue, 10 Dec 2024 11:57:41 +0000 (22:57 +1100)]
test(chain): Update test docs to stop referencing `get_chain_position`

12 months agochore: Fix typos
志宇 [Tue, 10 Dec 2024 11:53:12 +0000 (22:53 +1100)]
chore: Fix typos

12 months agorefactor(wallet): Reuse chain position instead of obtaining new one
Jiri Jakes [Thu, 5 Dec 2024 08:51:37 +0000 (16:51 +0800)]
refactor(wallet): Reuse chain position instead of obtaining new one

In `Wallet::preselect_utxos()`, the code used to obtain chain position
of the UTXO's transaction from the graph, however the chain position
is already recorded within the UTXO's representation (`LocalOutput`).
This patch reuses the existing chain position instead of obtaining a
fresh one.

12 months agodocs(wallet): Explain `.take` usage
志宇 [Tue, 10 Dec 2024 10:56:37 +0000 (21:56 +1100)]
docs(wallet): Explain `.take` usage

12 months agorefactor(chain): Reorganize `TxGraph::insert_anchor` logic for clarity
志宇 [Tue, 10 Dec 2024 10:34:07 +0000 (21:34 +1100)]
refactor(chain): Reorganize `TxGraph::insert_anchor` logic for clarity

12 months agochore(chain): Address `CanonicalIter` nitpicks
志宇 [Tue, 10 Dec 2024 09:49:47 +0000 (20:49 +1100)]
chore(chain): Address `CanonicalIter` nitpicks

12 months agotest(chain): Add canonicalization test
志宇 [Fri, 6 Dec 2024 05:35:56 +0000 (16:35 +1100)]
test(chain): Add canonicalization test

Tx anchored in orphaned block and not seen in the mempool should be
canon.

12 months agorefactor(chain)!: Rename `LastSeenIn` to `ObservedIn`
志宇 [Fri, 6 Dec 2024 03:27:24 +0000 (14:27 +1100)]
refactor(chain)!: Rename `LastSeenIn` to `ObservedIn`

Also removed extra derives on `ObservedIn` and updated docs for
`CanonicalTx`.

12 months agoperf(chain): add benchmarks for canonicalization logic
志宇 [Tue, 3 Dec 2024 04:21:13 +0000 (15:21 +1100)]
perf(chain): add benchmarks for canonicalization logic

This is mostly taken from #1735 except we inline many of the functions
and test `list_canonical_txs`, `filter_chain_unspents` and
`filter_chain_txouts` on all scenarios.

CI and README is updated to pin `csv`.

Co-authored-by: valued mammal <valuedmammal@protonmail.com>
12 months agofeat(chain): Derive `Clone` on `IndexedTxGraph`
志宇 [Tue, 3 Dec 2024 05:40:24 +0000 (16:40 +1100)]
feat(chain): Derive `Clone` on `IndexedTxGraph`

12 months agodocs: Add ADR for `O(n)` canonicalization algorithm
志宇 [Sun, 1 Dec 2024 04:59:09 +0000 (15:59 +1100)]
docs: Add ADR for `O(n)` canonicalization algorithm

12 months agotest(chain): Add transitive anchor tests
志宇 [Tue, 26 Nov 2024 04:10:18 +0000 (15:10 +1100)]
test(chain): Add transitive anchor tests

12 months agofeat(chain)!: rm `get_chain_position` and associated methods
志宇 [Tue, 19 Nov 2024 06:26:50 +0000 (17:26 +1100)]
feat(chain)!: rm `get_chain_position` and associated methods

12 months agofeat(chain)!: `O(n)` canonicalization algorithm
志宇 [Sun, 3 Nov 2024 01:51:58 +0000 (12:51 +1100)]
feat(chain)!: `O(n)` canonicalization algorithm

This is an O(n) algorithm to determine the canonical set of txids.

* Run 1: Iterate txs with anchors, starting from highest anchor height
  txs.
* Run 2: Iterate txs with last-seen values, starting from highest
  last-seen values.
* Run 3: Iterate txs that are remaining from run 1 which are not
  anchored in the best chain.

Since all transitively-anchored txs are added to the `canonical` set in
run 1, and anything that conflicts to anchored txs are already added to
`not_canonial`, we can guarantee that run 2 will not traverse anything
that directly or indirectly conflicts anything that is anchored.

Run 3 is needed in case a tx does not have a last-seen value, but is
seen in a conflicting chain.

`TxGraph` is updated to include indexes `txids_by_anchor_height` and
`txids_by_last_seen`. These are populated by the `insert_anchor` and
`insert_seen_at` methods. Generic constaints needed to be tightened as
these methods need to be aware of the anchor height to create
`LastSeenIn`.

12 months agofeat(chain)!: Add `run_until_finished` methods
志宇 [Tue, 26 Nov 2024 01:36:59 +0000 (12:36 +1100)]
feat(chain)!: Add `run_until_finished` methods

Add `run_until_finished` methods for `TxAncestors` and `TxDescendants`.
This is useful for traversing until the internal closure returns `None`.

Signatures of `TxAncestors` and `TxDescendants` are changed to enforce
generic bounds in the type definition.

12 months agofeat(chain)!: `TxGraph` contain anchors in one field
志宇 [Wed, 16 Oct 2024 14:28:23 +0000 (14:28 +0000)]
feat(chain)!: `TxGraph` contain anchors in one field

Previously, the field `TxGraph::anchors` existed because we assumed
there was use in having a partially-chronological order of transactions
there. Turns out it wasn't used at all.

This commit removes anchors from the `txs` field and reworks `anchors`
field to be a map of `txid -> set<anchors>`.

This is a breaking change since the signature of `all_anchors()` is
changed.

Update `TxGraph` field docs for `empty_outspends` and `empty_anchors`.

12 months agoMerge bitcoindevkit/bdk#1752: Remove serde json dependency from chain crate
Steve Myers [Mon, 9 Dec 2024 02:19:39 +0000 (20:19 -0600)]
Merge bitcoindevkit/bdk#1752: Remove serde json dependency from chain crate

1c81cd53fb859f4fa9e416c1a776f5295f7da44b refactor(chain)!: change String by &str for versioned scripts in migrate_schema (nymius)
265b59b6ef1c148875f4d6601e5a7e5f0b01785a test(chain): add compatibility test for v0 to v1 sqlite schema migration (nymius)
4ec7940158e80c0e8d657ffa07f540de81e3cbfa test(wallet): pattern match ChainPosition::Confirmed in anchors persistence check (nymius)
2eb19f5073abd7d5e9c9b4183aa5efac6e76aca9 refactor(chain)!: move schemas to their own methods (nymius)
5603e9f6d1d3ff130317d6fd16332bf8b049b409 test(chain): use ChangeSet<ConfirmationBlockTime> instead of ChangeSet<BlockId> (nymius)
c3ea54d3bc8383148f86800bc60d2469486885a4 test(wallet): check persisted anchors does not lose data (nymius)
d41cb62193973481cb18bb40d61a4b17609a8248 build(chain): remove serde_json dependency (nymius)
7319f510016014a2ce4f9ab6e194e36345829357 refactor(chain)!: remove AnchorImpl wrapper for Anchor implementors (nymius)
b587b0fcadcc61b9f46336ffee5621363e409092 refactor(chain)!: impl sqlite for ConfirmationBlockTime anchored changesets (nymius)

Pull request description:

  ### Description

  As expressed by @LLFourn _We want to not depend on serde_json. If we keep it around for serializing anchors we won't be able to remove it in the future because it will always be needed to do migrations_
  Currently there is only one widely used anchor, `ConfirmationBlockTime`.

  The decision was to constrain support to just be for a single anchor type ConfirmationBlockTime. The anchor table will represent all fields of `ConfirmationBlockTime`, each one in its own column.

  The reasons:

  - No one is using rusqlite with any other anchor type, and if they are, they can do something custom anyway.
  - The anchor representation may change in the future, supporting for multiple Anchor types here will cause more problems for migration later on.

  Resolves #1695

  ### Notes to the reviewers

  <details>
      <summary>Why the type of the confirmation_time column is INTEGER?</summary>

  By [sqlite3 docs](https://www.sqlite.org/datatype3.html):

  > Each value stored in an SQLite database (or manipulated by the database engine) has one of the following storage classes:
  > ...
  > INTEGER. The value is a *signed integer*, stored in 0, 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value.

  (Remember confirmation time is `u64`)
  > REAL. The value is a floating point value, stored as an 8-byte IEEE floating point number.
  > ...
  > SQLite uses a more general dynamic type system. In SQLite, the datatype of a value is associated with the value itself, not with its container.
  > ...
  > In order to maximize compatibility between SQLite and other database engines, ..., SQLite supports the concept of "type affinity" on columns. The type affinity of a column is the recommended type for data stored in that column. The important idea here is that the type is recommended, not required. Any column can still store any type of data. It is just that some columns, given the choice, will prefer to use one storage class over another. The preferred storage class for a column is called its "affinity".
  > ...
  > A column with NUMERIC affinity may contain values using all five storage classes. When text data is inserted into a NUMERIC column, **the storage class of the text is converted to INTEGER or REAL (in order of preference)** if the text is a well-formed integer or real literal, respectively.
  > A column that uses INTEGER affinity behaves the same as a column with NUMERIC affinity.

  But anchor table was defined using the STRICT keyword, again, by sqlite docs:

  > ... The STRICT keyword causes the following differences:
  > ...
  > SQLite attempts to coerce the data into the appropriate type using the usual affinity rules, as PostgreSQL, MySQL, SQL Server, and Oracle all do. *If the value cannot be losslessly converted* in the specified datatype, then an SQLITE_CONSTRAINT_DATATYPE error is raised.

  So, the *TLDR*, with some help of this [blog post](https://jakegoulding.com/blog/2011/02/06/sqlite-64-bit-integers/) is:
  - SQLite INTEGER supported values range from `-2**63 to (2**63-1)`
  - If the number is bigger it will treat the number as REAL.
  - As the SQLite table is defined with the STRICT keyword, it should enforce a losslessly conversion or fail with SQLITE_CONSTRAINT_DATATYPE.

  </details>

  <details>
      <summary>Why not setting confirmation_time as BLOB or NUMERIC?</summary>

  I don't have a strong opinion on this. INTEGER was the first numeric type I found, then later I found NUMERIC and they seemed to behave in the same way, so I didn't change the type.

  I discarded BLOB and ANY first because they didn't provide a clear idea of what was being stored in the column, but in retrospective they seem to remove all the considerations that I had to do above, so maybe they are better fitted for the type.
  </details>

  <details>
      <summary>Why adding a default value to confirmation_time column if the anchor column constraint is to be NOT NULL so all copied values will be filled?</summary>

   `confirmation_time` should have the same constraint as `anchor`, to be `NOT NULL`, but as UPDATE statements might be executed in already filled tables, you must provide a default value for all the rows you are going to add the new column to. As the `confirmation_time` extraction of the json blob in anchor cannot be performed in the same step, I had to add this default value.

  This is flexibilizing the schema of the tables and extending the bug surface it may have, but I'm assuming the application layer will enforce the addition of a valid `confirmation_time` always.
  </details>

  <details>
      <summary>Why the default value of confirmation_time column is -1?</summary>

  Considering the other alternatives were to use the max value, min value or zero and confirmation time should always be positive, I considered `-1` just to be computer and human readable enough to perceive there must be something wrong if the `ConfirmationBlockTime` retrieved by the load of the wallet has this value set as the confirmation time.
  </details>

  <details>
      <summary>Why to not be STRICT with each statement?</summary>

  It is a constraint only applicable to tables on creation.
  </details>

  <details>
      <summary>Why not creating a whole new table without anchor column and with the confirmation_time column, copy the content from one to the other and drop the former table?</summary>

  Computation cost. I didn't benchmark it, and I don't know how efficient is SQLite engine under the hood, but at first sight it seems copying a single column is better than copying four.
  </details>

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

  - Reduce `rusqlite` implementation only to `ChangeSet<ConfirmationBlockTime>`.
  - Replace `anchor` column in sqlite by `confirmation_time`.
  - Modify `migrate_schema` `versioned_script` parameter's type to `&[&str]`.
  - Transformed existing schemas in methods to allow their individual application.

  ### Checklists

  #### All Submissions:

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

  #### New Features:

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

  #### Bugfixes:

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

ACKs for top commit:
  evanlinjin:
    ACK 1c81cd53fb859f4fa9e416c1a776f5295f7da44b
  notmandatory:
    ACK 1c81cd53fb859f4fa9e416c1a776f5295f7da44b

Tree-SHA512: 96facb59d49c29bb19096b0426c0d0c9a909a17541502b5a6f80b0075a333a354cfe9d0e247f07dd5931793412512ecdd80f22ae8ace85d0bb2cbb1abdfcfa9a

12 months agoMerge bitcoindevkit/bdk#1756: fix(electrum): prevent `fetch_prev_txout` from querying...
志宇 [Fri, 6 Dec 2024 07:24:20 +0000 (18:24 +1100)]
Merge bitcoindevkit/bdk#1756: fix(electrum): prevent `fetch_prev_txout` from querying coinbase transactions

d4ef26611b83baefac65fffc0758c6ac55ade9cb test(electrum): `fetch_prev_txout` does not process coinbase transactions (Wei Chen)
0944b352156fcd797a5c199a462ccaed3761db0a fix(electrum): prevent `fetch_prev_txout` from querying coinbase transactions (Wei Chen)

Pull request description:

  Fixes #1698.

  ### Description

  `fetch_prev_txout` should not try to query the prevouts of coinbase transactions, as it may result in the Electrum server returning an error which would cause the overall `sync`/`full_scan` to fail. Without this critical bug fix,  `bdk_electrum` will crash when someone tracks an address being mined to.

  ### Notes to the reviewers

  ### Changelog notice

  * `fetch_prev_txout` no longer queries coinbase transactions.

  ### Checklists

  #### All Submissions:

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

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

Tree-SHA512: 6423f9486e84f204cf756117cabff35ce79ee169efa43a059c1669ad0f7193b58299eee7c5672af35ab070ed8011637b0a1904866ce2f2fa4580ddc3f9f2d982

12 months agotest(electrum): `fetch_prev_txout` does not process coinbase transactions
Wei Chen [Wed, 4 Dec 2024 05:45:45 +0000 (13:45 +0800)]
test(electrum): `fetch_prev_txout` does not process coinbase transactions

12 months agofix(electrum): prevent `fetch_prev_txout` from querying coinbase transactions
Wei Chen [Wed, 6 Nov 2024 16:33:51 +0000 (00:33 +0800)]
fix(electrum): prevent `fetch_prev_txout` from querying coinbase transactions

\`fetch_prev_txout\` should not try to query the prevouts of coinbase
transactions, as it may result in the Electrum server returning an error
which would cause the overall `sync` to fail.

12 months agoMerge bitcoindevkit/bdk#1746: deps(esplora): bump `esplora-client` to 0.11.0
Steve Myers [Fri, 6 Dec 2024 04:09:09 +0000 (22:09 -0600)]
Merge bitcoindevkit/bdk#1746: deps(esplora): bump `esplora-client` to 0.11.0

90fd1a2715c08600cb894ee83717cac5522f4334 docs(esplora): update README.md (valued mammal)
f0e6395d7f39346df497c51ef7df645dbe5e9fd3 deps(esplora): bump `esplora-client` to 0.11.0 (valued mammal)

Pull request description:

  Update `bdk_esplora` to depend on esplora-client 0.11.0

  ### Notes to the reviewers

  bitcoindevkit/rust-esplora-client#103 added a generic type parameter to `AsyncClient` representing a user-defined `Sleeper` and that change is reflected here in order to call the underlying API methods. We also add a new build feature "tokio" that enables the corresponding feature in rust-esplora-client.

  closes #1742

  ### Changelog notice

  `bdk_esplora`: Bump `esplora-client` to 0.11.0

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing
  * [x] This pull request breaks the existing API
  * [x] I'm linking the issue being fixed by this PR

ACKs for top commit:
  notmandatory:
    tACK 90fd1a2715c08600cb894ee83717cac5522f4334
  oleonardolima:
    ACK 90fd1a2715c08600cb894ee83717cac5522f4334

Tree-SHA512: 98d529d3bb0dbbf4bbafeea7d30ec5e5816ac9800ba2cb7981fc6189b4b02774956c3ddbb74bf0b3e6e22798bfced36508263e4e89c248b7a6240c5c7109107b

12 months agodocs(esplora): update README.md
valued mammal [Wed, 4 Dec 2024 14:12:54 +0000 (09:12 -0500)]
docs(esplora): update README.md

12 months agodeps(esplora): bump `esplora-client` to 0.11.0
valued mammal [Sat, 23 Nov 2024 21:47:23 +0000 (16:47 -0500)]
deps(esplora): bump `esplora-client` to 0.11.0

12 months agorefactor(chain)!: change String by &str for versioned scripts in migrate_schema
nymius [Wed, 4 Dec 2024 17:08:43 +0000 (14:08 -0300)]
refactor(chain)!: change String by &str for versioned scripts in migrate_schema

`&str` is documenting clearly that `migrate_schema` should only read
`versioned_strings`.

Also, as `schema_vN` methods will return `String`, rust will always
automatically deref `&String` to `&str`.

BREAKING CHANGE: changes parameter versioned_strings from public
function migrate_schema from type &[String] to &[&str].

12 months agotest(chain): add compatibility test for v0 to v1 sqlite schema migration
nymius [Wed, 4 Dec 2024 15:36:57 +0000 (12:36 -0300)]
test(chain): add compatibility test for v0 to v1 sqlite schema migration

Why just v0 to v1 test and not a general backward compatibility test?

Is harder to craft a general compatibility test without prior knowledge
of how future schemas would look like. Also, the creation of a backward
compatibility test for each new schema change will allow the execution
of incremental backward compatibility tests with better granularity.

12 months agotest(wallet): pattern match ChainPosition::Confirmed in anchors persistence check
nymius [Mon, 2 Dec 2024 15:29:14 +0000 (12:29 -0300)]
test(wallet): pattern match ChainPosition::Confirmed in anchors persistence check

12 months agorefactor(chain)!: move schemas to their own methods
nymius [Mon, 2 Dec 2024 15:26:55 +0000 (12:26 -0300)]
refactor(chain)!: move schemas to their own methods

We would like to test backward compatibility of new schemas.
To do so, we should be able to apply schemas independently.

Why to change `rusqlite::execute` by `rusqlite::execute_batch`?
- we are going to need to return the statements of the schemas as
  Strings, because we are now returning them from methods, it seemed
  redundant to keep getting references to something is already
  referencing data, i.e., keep moving around &String instead of String
  (consider `rusqlite::execute_batch` takes multiple statements as a
  single String)
- we were calling `rusqlite::execute` with empty params, so we weren't
  trapped by the method's signature
- `rustqlite::execute_batch` does the same than we were doing applying
  statements secuentially in a loop
- the code doesn't lose error expresivity: `rusqlite::execute_batch` is
  going to fail with the same errors `rusqlite::execute` does

BREAKING CHANGE: changes public method `migrate_schema` signature.

12 months agotest(chain): use ChangeSet<ConfirmationBlockTime> instead of ChangeSet<BlockId>
nymius [Fri, 29 Nov 2024 15:58:40 +0000 (12:58 -0300)]
test(chain): use ChangeSet<ConfirmationBlockTime> instead of ChangeSet<BlockId>

The only struct implementing rustqlite is
ChangeSet<ConfirmationBlockTime> from
c49ea85423a20ebc29e3bf4ae3a6d2acdc78b8a5 on.

12 months agotest(wallet): check persisted anchors does not lose data
nymius [Fri, 29 Nov 2024 00:42:13 +0000 (21:42 -0300)]
test(wallet): check persisted anchors does not lose data

12 months agobuild(chain): remove serde_json dependency
nymius [Fri, 29 Nov 2024 00:10:53 +0000 (21:10 -0300)]
build(chain): remove serde_json dependency

12 months agorefactor(chain)!: remove AnchorImpl wrapper for Anchor implementors
nymius [Thu, 28 Nov 2024 23:58:36 +0000 (20:58 -0300)]
refactor(chain)!: remove AnchorImpl wrapper for Anchor implementors

AnchorImpl was a wrapper created to allow the implementation of foreign
traits, like From/ToJson from serde_json for external unknown structs
implementing the Anchor trait.

As the Anchor generic in the rusqlite implementation for anchored
ChangeSets was the only place where this AnchorImpl was used and it has
been fixed to the anchor ConfirmationBlockTime, there is no more reason
to keep this wrapper around.

12 months agorefactor(chain)!: impl sqlite for ConfirmationBlockTime anchored changesets
nymius [Wed, 27 Nov 2024 01:05:08 +0000 (22:05 -0300)]
refactor(chain)!: impl sqlite for ConfirmationBlockTime anchored changesets

We want to not depend on serde_json. If we keep it around for
serializing anchors we won't be able to remove it in the future because
it will always be needed to do migrations.
Currently there is only one widely used anchor, ConfirmationBlockTime.

The desicion was to constrain support to just be for a single anchor
type ConfirmationBlockTime. The anchor table will represent all fields
of ConfirmationBlockTime, each one in its own column.

The reasons:

- No one is using rusqlite with any other anchor type, and if they are,
  they can do something custom anyway.
- The anchor representation may change in the future, supporting for
  multiple Anchor types here will cause more problems for migration
  later on.

12 months agoMerge bitcoindevkit/bdk#1737: fix(tx_builder)!: make TxBuilder Send safe, remove...
Steve Myers [Tue, 3 Dec 2024 04:22:17 +0000 (22:22 -0600)]
Merge bitcoindevkit/bdk#1737: fix(tx_builder)!: make TxBuilder Send safe, remove Clone trait

663fb133a4aeac7e50f5d32bdba2b316b17a7e2b fix(tx_builder)!: make TxBuilder Send safe, remove Clone trait (Steve Myers)

Pull request description:

  ### Description

  Inspired by discord chat with @stevenroose as a way to make the `TxBuilder` Send safe.

  See his original patch on 1.0.0-beta.5: https://gist.github.com/stevenroose/f7736dfedfaa64bbdbb0da5875df28fc

  ### Notes to the reviewers

  I had to remove the `Clone` trait on `TxBuilder` but it was only being used in tests.

  ### Changelog notice

  - TxBuilder is now Send safe and does not implement the Clone trait

  ### Checklists

  #### All Submissions:

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

  #### New Features:

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

ACKs for top commit:
  evanlinjin:
    ACK 663fb133a4aeac7e50f5d32bdba2b316b17a7e2b

Tree-SHA512: 026c0f5f227b5613bbab069b2c5238266aea6f6c2ae184cf77d37777fee2ddd52a99c9e305c107a2edd855dbd182d1b9194de361703995732061649f155cb65f

12 months agoMerge bitcoindevkit/bdk#1751: deps(electrum): bump `electrum-client` to 0.22.0
Steve Myers [Tue, 3 Dec 2024 03:17:43 +0000 (21:17 -0600)]
Merge bitcoindevkit/bdk#1751: deps(electrum): bump `electrum-client` to 0.22.0

2be3b022b995d5af1a0e0fea958cb973d32085b0 deps(electrum): bump `electrum-client` to 0.22.0 (Wei Chen)

Pull request description:

  Partially resolves #1742.

  ### Description

  Updates the `electrum-client` dependency to 0.22.0 for `bdk_electrum`.

  ### Notes to the reviewers

  ### Changelog notice

  * Updated `electrum-client` dependency to 0.22.0.

  ### Checklists

  #### All Submissions:

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

ACKs for top commit:
  notmandatory:
    ACK 2be3b022b995d5af1a0e0fea958cb973d32085b0

Tree-SHA512: 72a893b3939f217823382be815a38e13bef0201ac4b320a6de9c92ff36f2d013f95701e01afba95a5e4fcd874d8f3b0f2c432de608a6d41746b03dc4d03cb6e8

12 months agoMerge bitcoindevkit/bdk#1733: feat(chain,wallet)!: Transitive `ChainPosition`
valued mammal [Sun, 1 Dec 2024 19:12:01 +0000 (14:12 -0500)]
Merge bitcoindevkit/bdk#1733: feat(chain,wallet)!: Transitive `ChainPosition`

29b374e383bc9317b55a2a58019e1948e170fabd feat(chain,wallet)!: Transitive `ChainPosition` (志宇)

Pull request description:

  ### Description

  Change `ChainPosition` to be able to represent transitive anchors and unconfirm-without-last-seen values.

  As mentioned in https://github.com/bitcoindevkit/bdk/pull/1670#issuecomment-2484535021, we want this merged first so that we have minimal changes to the API after 1670 is merged.

  ### Changelog notice

  * Change `ChainPosition` so that it is able to represent transitive anchors and unconfirmed-without-last-seen values.

  ### Checklists

  #### All Submissions:

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

  #### New Features:

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

ACKs for top commit:
  ValuedMammal:
    ACK 29b374e383bc9317b55a2a58019e1948e170fabd

Tree-SHA512: 58f22f38201304611341835f22f2526254009077cde6dfcd1f6051aec906ddae78f45ebd7900c35c0fb5165ed10e48a45a55fca73395edcf9bec2fb1daa1acc6

12 months agofeat(chain,wallet)!: Transitive `ChainPosition`
志宇 [Tue, 19 Nov 2024 07:47:10 +0000 (18:47 +1100)]
feat(chain,wallet)!: Transitive `ChainPosition`

Change `ChainPosition` to be able to represent transitive anchors and
unconfirm-without-last-seen values.

12 months agodeps(electrum): bump `electrum-client` to 0.22.0
Wei Chen [Fri, 29 Nov 2024 10:07:02 +0000 (18:07 +0800)]
deps(electrum): bump `electrum-client` to 0.22.0

12 months agoMerge bitcoindevkit/bdk#1749: chore: Revert `rustls` pin dependency
valued mammal [Fri, 29 Nov 2024 13:51:57 +0000 (08:51 -0500)]
Merge bitcoindevkit/bdk#1749: chore: Revert `rustls` pin dependency

8e5a7c67c0c6be4da259e6015e9a7575df0f1385 chore: Revert `rustls` pin dependency (志宇)

Pull request description:

  ### Description

  The recent release of `rustls` (0.23.19) reverts it's MSRV to 1.63 so the pin is no longer necessary.

  ### Notes to the reviewers

  Some context:
  * https://github.com/bitcoindevkit/rust-electrum-client/pull/158
  * https://github.com/rustls/rustls/pull/2244

  ### Changelog notice

  * Revert MSRV pin of `rustls`.

  ### 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:
  LagginTimes:
    ACK 8e5a7c67c0c6be4da259e6015e9a7575df0f1385
  ValuedMammal:
    ACK 8e5a7c67c0c6be4da259e6015e9a7575df0f1385

Tree-SHA512: 355291f93a879effc8aa1d7fe0254d8f879f26d06f0d6b0ad3d7a508a53179f7c5b9ebcd2d450ee042fbd2867119cf9a15c3193af6f36c3e5548634ce689cdca

12 months agochore: Revert `rustls` pin dependency
志宇 [Fri, 29 Nov 2024 01:59:04 +0000 (12:59 +1100)]
chore: Revert `rustls` pin dependency

The recent release of `rustls` (0.23.19) reverts it's MSRV to 1.63 so
the pin is no longer necessary.

12 months agoMerge bitcoindevkit/bdk#1736: Sqlite - allow persisting anchor without tx
志宇 [Thu, 28 Nov 2024 10:49:28 +0000 (21:49 +1100)]
Merge bitcoindevkit/bdk#1736: Sqlite - allow persisting anchor without tx

18f5f3fa21f5e83dab9e30a5f536e5526883d580 test(sqlite): test persisting anchors and txs independently (valued mammal)
297ff3414909ae42d34c31f5c942fc81aa1d60f9 test(chain): add test `insert_anchor_without_tx` (valued mammal)
e69d10e7d387ffc96876b4290131d8fa9d4dd8ff doc(chain): document module `rusqlite_impl` (valued mammal)
8fa899b74619b549e4880c28a0f1d348cb68f755 fix(chain): Sqlite - allow persisting anchor without tx (志宇)

Pull request description:

  ### Description

  Previously, we may error when we insert an anchor where the txid being anchored has no corresponding tx.

  closes #1712
  replaces #961

  ### 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
  * [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 18f5f3fa21f5e83dab9e30a5f536e5526883d580
  ValuedMammal:
    ACK 18f5f3fa21f5e83dab9e30a5f536e5526883d580

Tree-SHA512: 7343eff857016f684cfb9f7af57f7be56ba36c70c36b8b4303159636f79ad5cc49a6f94354443323c9aa05c31ec7d43c22b038d9e41361596c3a346bd6a94b10

12 months agotest(sqlite): test persisting anchors and txs independently
valued mammal [Mon, 25 Nov 2024 00:51:45 +0000 (19:51 -0500)]
test(sqlite): test persisting anchors and txs independently

12 months agotest(chain): add test `insert_anchor_without_tx`
valued mammal [Sun, 24 Nov 2024 23:34:43 +0000 (18:34 -0500)]
test(chain): add test `insert_anchor_without_tx`

12 months agodoc(chain): document module `rusqlite_impl`
valued mammal [Sun, 24 Nov 2024 23:32:55 +0000 (18:32 -0500)]
doc(chain): document module `rusqlite_impl`

12 months agofix(chain): Sqlite - allow persisting anchor without tx
志宇 [Wed, 20 Nov 2024 22:43:13 +0000 (09:43 +1100)]
fix(chain): Sqlite - allow persisting anchor without tx

Previously, we may error when we insert an anchor where the txid being
anchored has no corresponding tx.

12 months agoMerge bitcoindevkit/bdk#1745: ci: pin `rustls` dependency version to build with rust...
志宇 [Mon, 25 Nov 2024 05:14:48 +0000 (16:14 +1100)]
Merge bitcoindevkit/bdk#1745: ci: pin `rustls` dependency version to build with rust 1.63

3cb5d35e1150ac2f9c0418757ff605fdbf324cee ci: pin `rustls` dependency version to build with rust 1.63 (Wei Chen)

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 -->
  `rustls` version 0.23.18 raised msrv to 1.71.
  Version 0.23.17 was pinned to CI to continue working.

  ### 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 -->
  * Pinned rustls dependency version to build with rust 1.63.

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

Tree-SHA512: cd060438fdc55eddf6c3b9fbebf4ba415a9d602a6b433352763d4f351dba3d91ce186cd00844dc5536dfe78ad0d191bb62e8f315c763884d0a57f1da0ce7c55c

12 months agoci: pin `rustls` dependency version to build with rust 1.63
Wei Chen [Sun, 24 Nov 2024 23:45:24 +0000 (07:45 +0800)]
ci: pin `rustls` dependency version to build with rust 1.63

12 months agofix(tx_builder)!: make TxBuilder Send safe, remove Clone trait
Steve Myers [Wed, 20 Nov 2024 17:19:57 +0000 (11:19 -0600)]
fix(tx_builder)!: make TxBuilder Send safe, remove Clone trait

12 months agoMerge bitcoindevkit/bdk#1734: chore(chain)!: use `debug_assert!` on `apply_update`
Steve Myers [Fri, 22 Nov 2024 01:03:41 +0000 (19:03 -0600)]
Merge bitcoindevkit/bdk#1734: chore(chain)!: use `debug_assert!` on `apply_update`

2ec5aa488e9317d027d9625c1a4222e8c384b38e chore(chain)!: use `debug_assert!` on `apply_update` (Leonardo Lima)

Pull request description:

  fixes #1689

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

  ### Description
  As mentioned in issue #1689 the `debug_assert!` is being used on other `LocalChain` methods, such as: `from_changeset`, and `apply_changeset` but it was missing on `apply_update`.

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

  - Add usage of `debug_assert!()` to `LocalChain::apply_update`.

  ### Checklists

  #### All Submissions:

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

  #### New Features:

  * [ ] 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:
  ValuedMammal:
    ACK 2ec5aa488e9317d027d9625c1a4222e8c384b38e Thank you @oleonardolima
  notmandatory:
    ACK 2ec5aa488e9317d027d9625c1a4222e8c384b38e

Tree-SHA512: 31ac1accc825fb2b9ecfde38e43c2a662f933cfc0b8488775276ca770a5cce1d61a20ad8ba689327ed264252ad2f3ae10c9baba462a22f567395df493fb24886

12 months agoMerge bitcoindevkit/bdk#1721: chore(deps): bump hashbrown to v0.14.5
Steve Myers [Thu, 21 Nov 2024 17:39:25 +0000 (11:39 -0600)]
Merge bitcoindevkit/bdk#1721: chore(deps): bump hashbrown to v0.14.5

52fa5404bdecc96939f47f7567e2605f449b4b2a chore(deps): bump hashbrown to v0.14.5, disable default features (Tommy Volk)

Pull request description:

  Bump [`hashbrown`](https://crates.io/crates/hashbrown) to v0.15

  I ran [`cargo build-all-features` and `cargo test-all-features`](https://github.com/frewsxcv/cargo-all-features) locally for the `core` crate with no issues. Here's the output for the former:

  ```
  cargo build-all-features

      Building crate=bdk_core features=[]
      Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.04s
      Building crate=bdk_core features=[hashbrown]
      Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.04s
      Building crate=bdk_core features=[serde]
      Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.05s
      Building crate=bdk_core features=[std]
      Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.04s
      Building crate=bdk_core features=[hashbrown,serde]
      Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.04s
      Building crate=bdk_core features=[hashbrown,std]
      Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.04s
      Building crate=bdk_core features=[serde,std]
      Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.04s
      Building crate=bdk_core features=[hashbrown,serde,std]
      Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.04s
  ```

  The relevant changelog can be found between [here](https://github.com/rust-lang/hashbrown/blob/master/CHANGELOG.md#v0100---2021-01-16) and [here](https://github.com/rust-lang/hashbrown/blob/master/CHANGELOG.md#v0151---2024-11-03)

  The only notable breaking change I found was that the MSRV was bumped to v1.63. However, this is the same MSRV as we already use, so it's not a breaking change for us.

ACKs for top commit:
  notmandatory:
    ACK 52fa5404bdecc96939f47f7567e2605f449b4b2a

Tree-SHA512: 8281148b86c80e7e7dd32c40d1bc5081c0e772876e9db3f0e20a9748e755f541fa923ad596be3de5f1bb2d8e46ab8987196869ca445f46afa696b2c7552d829e

12 months agoMerge bitcoindevkit/bdk#1730: Check time when persisting in `rusqlite` impl
Steve Myers [Thu, 21 Nov 2024 03:23:08 +0000 (21:23 -0600)]
Merge bitcoindevkit/bdk#1730: Check time when persisting in `rusqlite` impl

8ec9c0a7495acc2cdc6f4444d1a1d3aca566b17b fix(chain): check time when persisting (Rob N)

Pull request description:

  Closes #1713

  Any implementation overflowing the `i64` type would be clearly faulty, so I just pass up the error if the conversion fails.

  ### 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 8ec9c0a7495acc2cdc6f4444d1a1d3aca566b17b
  oleonardolima:
    utACK 8ec9c0a7495acc2cdc6f4444d1a1d3aca566b17b

Tree-SHA512: ded7c036f7a082e181e52f0366410f572227d57af37fdfd0fc0909f629a48ad1ed69f5c8549c45fe6c7aadb7e3fa62d2b56990028bc7fd321e43d39b79d77b00

12 months agoMerge bitcoindevkit/bdk#1681: types: Make Utxo::Foreign::sequence not optional
Steve Myers [Thu, 21 Nov 2024 03:19:07 +0000 (21:19 -0600)]
Merge bitcoindevkit/bdk#1681: types: Make Utxo::Foreign::sequence not optional

d96dac426187379890fb84315a51d81f37bbd0dc types: Make Utxo::Foreign::sequence not optional (Steven Roose)

Pull request description:

  It's never kept internally as optional at this point.

ACKs for top commit:
  notmandatory:
    ReACK d96dac426187379890fb84315a51d81f37bbd0dc

Tree-SHA512: 03d72dbdb0b2b05e6e15d235e35d77bb5ed85dfa9f3bedc879a50edcd3cd22277624854c76b270bc4987f5c463bba735d6a10ac97da6aae75d503e5e1f816c6a