]> Untitled Git - bdk/log
bdk
23 months agofeat(bitcoind_rpc)!: emissions include checkpoint and connected_to data
志宇 [Sat, 30 Dec 2023 12:48:20 +0000 (20:48 +0800)]
feat(bitcoind_rpc)!: emissions include checkpoint and connected_to data

Previously, emissions are purely blocks + the block height. This means
emitted blocks can only connect to previous-adjacent blocks. Hence, sync
must start from genesis and include every block.

23 months agotest(chain): `LocalChain` test for update that is shorter than original
志宇 [Fri, 29 Dec 2023 10:23:42 +0000 (18:23 +0800)]
test(chain): `LocalChain` test for update that is shorter than original

23 months agofeat(wallet): introduce block-by-block api
Vladimir Fomene [Wed, 11 Oct 2023 10:42:21 +0000 (13:42 +0300)]
feat(wallet): introduce block-by-block api

* methods `process_block` and `process_unconfirmed_txs` are added
* amend stage method docs

Co-authored-by: Vladimir Fomene <vladimirfomene@gmail.com>
Co-authored-by: 志宇 <hello@evanlinjin.me>
23 months agofeat(chain): add `apply_header..` methods to `LocalChain`
志宇 [Wed, 10 Jan 2024 16:05:04 +0000 (00:05 +0800)]
feat(chain): add `apply_header..` methods to `LocalChain`

These are convenience methods to transform a header into checkpoints to
update the `LocalChain` with. Tests are included.

23 months agofeat(chain): add `CheckPoint::from_block_ids` convenience method
志宇 [Wed, 10 Jan 2024 09:42:03 +0000 (17:42 +0800)]
feat(chain): add `CheckPoint::from_block_ids` convenience method

23 months agoMerge bitcoindevkit/bdk#1276: Add `LocalChain::disconnect_from` method
Daniela Brozzoni [Mon, 15 Jan 2024 12:56:48 +0000 (13:56 +0100)]
Merge bitcoindevkit/bdk#1276: Add `LocalChain::disconnect_from` method

bf67519768d91b049bf3a47c234ff71a81d0ede9 feat(chain): add `LocalChain::disconnect_from` method (志宇)

Pull request description:

  Closes #1271

  ### Description

  Add a method for disconnecting a chain of blocks starting from the given `BlockId`.

  ### Notes to the reviewers

  I want to have this for https://github.com/utreexo/utreexod/pull/110

  ### Changelog notice

  Added
  * `LocalChain::disconnect_from` method to evict a chain of blocks starting from a given `BlockId`.

  ### 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:
  danielabrozzoni:
    ACK bf67519768d91b049bf3a47c234ff71a81d0ede9

Tree-SHA512: e6bd213b49b553355370994567722ad2c3460d11fcd81adc65a85e5d03822d3c38e4a4d7f967044991cf0187845467b67d035bf8904871f9fcc4ea61be761ef7

23 months agofeat(chain): add `LocalChain::disconnect_from` method
志宇 [Mon, 15 Jan 2024 09:48:36 +0000 (17:48 +0800)]
feat(chain): add `LocalChain::disconnect_from` method

23 months agoMerge pull request #1274 from evanlinjin/avoid_btreemap_append
Lloyd Fournier [Mon, 15 Jan 2024 05:54:03 +0000 (16:54 +1100)]
Merge pull request #1274 from evanlinjin/avoid_btreemap_append

Avoid using `BTreeMap::append`

23 months agofix(chain): avoid using `BTreeMap::append`
志宇 [Sun, 7 Jan 2024 06:39:31 +0000 (14:39 +0800)]
fix(chain): avoid using `BTreeMap::append`

The implementation of `BTreeMap::append` is non-performant making
merging changesets very slow. We use `Extend::extend` instead.

Refer to:
https://github.com/rust-lang/rust/issues/34666#issuecomment-675658420

23 months agoMerge bitcoindevkit/bdk#1264: fix(example_electrum): init LocalChain from genesis
志宇 [Thu, 11 Jan 2024 09:00:30 +0000 (17:00 +0800)]
Merge bitcoindevkit/bdk#1264: fix(example_electrum): init LocalChain from genesis

5b7794299308cd81a2ebbe0aa2b1be1d4c47680b fix(example_electrum): init LocalChain from genesis (vmammal)

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

  This should fix #1252

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

Tree-SHA512: bf049edb2ba22abb949dfd4cb38608589287f3f374f397c82f778b59c21010daa80b63ad85c442c4ee00a2608f89a8d50447b0db85d15caac7fd0b4fd8956e1a

23 months agoMerge bitcoindevkit/bdk#1261: Refactor `reveal_to_target` and `next_store_index`
志宇 [Thu, 11 Jan 2024 02:59:45 +0000 (10:59 +0800)]
Merge bitcoindevkit/bdk#1261: Refactor `reveal_to_target` and `next_store_index`

761189ab2b679fbfee45b33435d66ed98a135e2a feat(chain): debug_assert non-wildcard desc. to only cache index 0 (志宇)
887e112e8f4ee5300bf09a0f3590861bff7fd053 ref(chain): Refactor reveal_to_target (Daniela Brozzoni)
21d88758262bfbc3d9d2109aac9883f23ab651c4 ref(chain): Refactor next_store_index (Daniela Brozzoni)

Pull request description:

  ### Description

  As a part of #1203, I found myself having to modify `reveal_to_target`, but had some troubles understanding exactly what the method was doing.

  This PR refactors `reveal_to_target` to be, in my opinion, a bit clearer. We now exist prematurely if `next_reveal_index` < `target_index`; this way, we don't need to keep track of `next_reveal_index`, as it would always be equal to `Some(target_index)`.
  As a part of trying to understand `reveal_to_target` I had to read through `next_store_index`, I slightly improved it for clarity reasons as well.

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

Tree-SHA512: 17f70bccbfa1cccf718ece0eeb61f4944c9108776cf1d606ef823ae9ff58bf52114750927ac99561644ece598f8131ee7f7605071d42c91e5e88e05035e74836

23 months agofeat(chain): debug_assert non-wildcard desc. to only cache index 0
志宇 [Tue, 9 Jan 2024 01:44:06 +0000 (09:44 +0800)]
feat(chain): debug_assert non-wildcard desc. to only cache index 0

23 months agofix(example_electrum): init LocalChain from genesis
vmammal [Tue, 28 Nov 2023 18:23:05 +0000 (13:23 -0500)]
fix(example_electrum): init LocalChain from genesis

23 months agoMerge bitcoindevkit/bdk#1263: Bump bdk_esplora and bdk_file_store versions for 1...
Steve Myers [Wed, 10 Jan 2024 01:22:58 +0000 (19:22 -0600)]
Merge bitcoindevkit/bdk#1263: Bump bdk_esplora and bdk_file_store versions for 1.0.0-alpha.3 release

8f6dad76efaa4af0ebb990ed83632f230fd10d94 Bump bdk_esplora and bdk_file_store versions for 1.0.0-alpha.3 release (Steve Myers)

Pull request description:

  ### Description

  These crates need to have their versions bumped because the version of bdk_chain was bumped to 0.7.0 with the 1.0.0-alpha.3 release.

  bdk_esplora to 0.5.0
  bdk_file_store to 0.3.0

  After this PR is merged I'll publish new versions of these crates to crates.io.

  ### Notes to the reviewers

  I should have done this as part of the 1.0.0-alpha.3 release process.  This problem was found when @thunderbiscuit started updating the bdk-ffi project to alpha.3 and we got type mismatch errors for bdk_chain types used in bdk_esplora.

ACKs for top commit:
  thunderbiscuit:
    ACK 8f6dad76efaa4af0ebb990ed83632f230fd10d94.

Tree-SHA512: 735094a5d78da082437118a38db085b12c26665c8cf8fd809d62dbe9a058ee04c59a165e454b3eb8baea4209330083a6a7bce8c303be1660f6593c80ccbe46b7

23 months agoBump bdk_esplora and bdk_file_store versions for 1.0.0-alpha.3 release
Steve Myers [Tue, 9 Jan 2024 21:05:55 +0000 (15:05 -0600)]
Bump bdk_esplora and bdk_file_store versions for 1.0.0-alpha.3 release

These crates need to have their versions bumped because the version of bdk_chain was bumped to 0.7.0 with the 1.0.0-alpha.3 release.

bdk_esplora to 0.5.0
bdk_file_store to 0.3.0

23 months agoref(chain): Refactor reveal_to_target
Daniela Brozzoni [Mon, 8 Jan 2024 13:47:28 +0000 (14:47 +0100)]
ref(chain): Refactor reveal_to_target

Simplify the `reveal_to_target` algorithm by exiting prematurely if
the `target_index` is already revealed.
Since the `reveal_to_index` variable was different from
`Some(target_index)` only if the target was already revealed, we can
getrid of the variable altogether.

23 months agoref(chain): Refactor next_store_index
Daniela Brozzoni [Mon, 8 Jan 2024 13:46:25 +0000 (14:46 +0100)]
ref(chain): Refactor next_store_index

Rename `v` to `index` for better clarity, and add a comment explaining
the `range`

23 months agoMerge bitcoindevkit/bdk#1161: ref(hwi): Move hwi out of bdk
Steve Myers [Mon, 8 Jan 2024 15:54:25 +0000 (09:54 -0600)]
Merge bitcoindevkit/bdk#1161: ref(hwi): Move hwi out of bdk

105d70e9743f651d141c6e0d901d60d583afd4d9 ref(hwi): Move hwi out of bdk (Daniela Brozzoni)

Pull request description:

  Fixes #872

  ### Description

  This commit moves the `hardwaresigner` outside of bdk and inside `bdk_hwi`

  ### Notes to the reviewers

  There are currently two issues with the code:
  - `TransactionSigner` dictates that `sign_transaction` must return a `SignerError` - but being `SignerError` defined inside of bdk, we can't modify it to include an hwi specific error! I don't know how we could fix this (other than getting rid of the trait altogether :)); for now I just added a `SignerError::Generic` variant, lmk if you have better ideas!
  - The hwi tests used the bdk utils to get a funded wallet for testing, which aren't available in `bdk_hwi`, which made me realize - maybe we should expose them so that we can use them across our crates, and also our users can use them to test their code?
  For now, I just left the test commented.

  ### Changelog notice

  - The old `hardwaresigner` module has been moved out of `bdk` and inside `bdk_hwi`.

  ### 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:
  notmandatory:
    reACK 105d70e9743f651d141c6e0d901d60d583afd4d9

Tree-SHA512: 9ae3cd035cc27bd7b2831e89c104f40771c6f165cb3bfe1a9052f820050fca7c19f4dd68f171c630a71a7d18ccdee5f94adbc497c6475bd257c2d01cc08109a1

23 months agoref(hwi): Move hwi out of bdk
Daniela Brozzoni [Mon, 9 Oct 2023 14:42:23 +0000 (16:42 +0200)]
ref(hwi): Move hwi out of bdk

Fixes #872

23 months agoMerge bitcoindevkit/bdk#1255: Bump bdk version to 1.0.0-alpha.3 v1.0.0-alpha.3
Steve Myers [Sun, 7 Jan 2024 16:50:20 +0000 (10:50 -0600)]
Merge bitcoindevkit/bdk#1255: Bump bdk version to 1.0.0-alpha.3

003271117cb347556cc82455558da40ef50a1156 Bump bdk version to 1.0.0-alpha.3 (Steve Myers)

Pull request description:

  ### Description

  - Bump bdk version to 1.0.0-alpha.3
  - Bump bdk_chain to 0.7.0
  - Bump bdk_bitcoin_rpc to 0.2.0
  - Bump bdk_electrum to 0.5.0

  ### Notes to the reviewers

  ### Changelog notice

  See #1254

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

Tree-SHA512: ac0756f52436880fe633e9ecb83f3d53f485ccfa89a3a89aa51ee4ba5da5cee87f507da69a9e1271f8aaf4425f65d04fb201ea9a4f64bce18f96039ea3548d61

23 months agoMerge bitcoindevkit/bdk#1259: Bump `bip39` dependency to v2.0
Steve Myers [Sun, 7 Jan 2024 16:36:13 +0000 (10:36 -0600)]
Merge bitcoindevkit/bdk#1259: Bump `bip39` dependency to v2.0

8694624bd5f63b738448c250d7b1042f219636da Bump `bip39` to v2.0 (Elias Rohrer)

Pull request description:

  We previously bumped the `bip39` version to 2.0 [in the 0.2X release branch](https://github.com/bitcoindevkit/bdk/pull/875). Back then, bumping it in `master` was [assumed unnecessary](https://github.com/bitcoindevkit/bdk/pull/875#issuecomment-1483990088). It seems this was erroneous, as the current `1.0.1` dependency is present since https://github.com/bitcoindevkit/bdk/pull/793, which was merged before the bump in `release/0.27`.

  Here, we therefore bump the crate version in `master` after all.

ACKs for top commit:
  notmandatory:
    ACK 8694624bd5f63b738448c250d7b1042f219636da

Tree-SHA512: a109219bc97bb8e965e8b10e72439aa898b710d1d1a154801ce499ad47475a6b23448d85e0de3f306f990573d1fccdae7d587ed41676a01f91d66a719782eae1

23 months agoBump `bip39` to v2.0
Elias Rohrer [Sun, 7 Jan 2024 16:08:30 +0000 (17:08 +0100)]
Bump `bip39` to v2.0

We previously bumped the `bip39` version to 2.0 in the 0.2X release
branch. Back then, bumping it in `master` was erroneously considered unnecessary.

Here, we therefore bump the crate version in `master` after all.

23 months agoBump bdk version to 1.0.0-alpha.3
Steve Myers [Wed, 3 Jan 2024 02:33:24 +0000 (20:33 -0600)]
Bump bdk version to 1.0.0-alpha.3

Bump bdk_chain to 0.7.0
Bump bdk_bitcoin_rpc to 0.2.0
Bump bdk_electrum to 0.5.0

23 months agoMerge bitcoindevkit/bdk#1258: fix(typos): existant -> existent
Steve Myers [Sat, 6 Jan 2024 20:24:26 +0000 (14:24 -0600)]
Merge bitcoindevkit/bdk#1258: fix(typos): existant -> existent

028caa9f8cd51afba0fdc81748fc8cf536c75cd0 fix(typos): existant -> existent (Jose Storopoli)

Pull request description:

  ### Description

  These typos are blocking the Nix typo CI in #1257

  ### Notes to the reviewers

  Blocking #1257

  ### Changelog notice

  - fix: typos in documentation
  -
  ### 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 028caa9f8cd51afba0fdc81748fc8cf536c75cd0

Tree-SHA512: 0bd91efd0eec55fdc537824435552c968858a5b827179b3f9f3f37785db3fa92d3e6f0c73023de0c506224c81217c402d5afa8a2f768fecaf6a3c8378226d184

23 months agofix(typos): existant -> existent
Jose Storopoli [Sat, 6 Jan 2024 17:13:56 +0000 (14:13 -0300)]
fix(typos): existant -> existent

These typos are blocking the Nix typo CI in #1257

23 months agoMerge bitcoindevkit/bdk#1256: cherry-pick feat(wallet)!: add `NonEmptyDatabase` varia...
志宇 [Sat, 6 Jan 2024 05:30:17 +0000 (13:30 +0800)]
Merge bitcoindevkit/bdk#1256: cherry-pick feat(wallet)!: add `NonEmptyDatabase` variant to `NewError`

a1d34afa2455d93d23a36fd78d94aa79c7e493d1 feat(wallet)!: add `NonEmptyDatabase` variant to `NewError` (志宇)

Pull request description:

  ### Description

  `NewError` is the error type when constructing a wallet with `Wallet::new`. We want this to return an error when the database already contains data (in which case, the caller should use `load` or `new_or_load`).

  ### Notes to the reviewers

  This is cherry-picked from #1172 so that we can add it to the alpha.3 release.

  ### Changelog notice

  Change
  - Return `NonEmptyDatabase` error when constructing a wallet with `Wallet::new` if the file already contains data (in which case, the caller should use `load` or `new_or_load`).

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

Tree-SHA512: 7c20171fa3d7dee5b1ac24f8a808781dbb0be0034951005e1e87acdf023123c01161e225b47b6d4484865889778c39549a3780f641227ddc0f84d1577d69f40a

23 months agofeat(wallet)!: add `NonEmptyDatabase` variant to `NewError`
志宇 [Tue, 2 Jan 2024 05:03:19 +0000 (13:03 +0800)]
feat(wallet)!: add `NonEmptyDatabase` variant to `NewError`

`NewError` is the error type when constructing a wallet with
`Wallet::new`. We want this to return an error when the database already
contains data (in which case, the caller should use `load` or
`new_or_load`).

23 months agoMerge bitcoindevkit/bdk#1235: Refactor/rename electrum_ext and esplora_ext to have...
Steve Myers [Sat, 6 Jan 2024 03:39:22 +0000 (21:39 -0600)]
Merge bitcoindevkit/bdk#1235: Refactor/rename electrum_ext and esplora_ext to have sync and full_scan functions

de54e710ed04e3cb1632cf99dbc1c6f2374b0c6e refactor(esplora_ext): rename scan_txs to sync and scan_txs_with_keychains to full_scan (Steve Myers)
95d34854f46fd154eed35008954b25b82785b2d8 refactor(electrum_ext): rename scan_without_keychain to sync and scan to full_scan (Steve Myers)

Pull request description:

  ### Description

  fixes #1112

  Simple function renaming plus updated docs:

  1. electrum_ext: rename functions `scan_without_keychain` to `sync` and `scan` to `full_scan`
  2. esplora_ext: rename functions `scan_txs` to `sync` and `scan_txs_with_keychains` to `full_scan`

  ### Notes to the reviewers

  The esplora_ext changes were partially fixed in #1070 but I renamed again so the functions match names ~~suggested in #1112~~ agreed on in discord poll, `sync` and `full_scan`.

  ### Changelog notice

  Changed

  - electrum_ext: rename functions scan_without_keychain to sync and scan to full_scan
  - esplora_ext: rename functions scan_txs to sync and scan_txs_with_keychains to full_scan

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

23 months agorefactor(esplora_ext): rename scan_txs to sync and scan_txs_with_keychains to full_scan
Steve Myers [Thu, 7 Dec 2023 03:21:02 +0000 (21:21 -0600)]
refactor(esplora_ext): rename scan_txs to sync and scan_txs_with_keychains to full_scan

removed txids and outpoints params from full_scan

23 months agorefactor(electrum_ext): rename scan_without_keychain to sync and scan to full_scan
Steve Myers [Thu, 7 Dec 2023 03:14:16 +0000 (21:14 -0600)]
refactor(electrum_ext): rename scan_without_keychain to sync and scan to full_scan

removed txids and outpoints params from full_scan

23 months agoMerge bitcoindevkit/bdk#1229: Use a universal lookahead value for `KeychainTxOutIndex...
志宇 [Fri, 29 Dec 2023 12:38:53 +0000 (20:38 +0800)]
Merge bitcoindevkit/bdk#1229: Use a universal lookahead value for `KeychainTxOutIndex` and have a reasonable default

1def76f1f17fc876534c798883099c58de57c0fd chore: make clippy happy and bump clippy msrv (志宇)
c9467dcbb27bd497006846dcfcefb0c2cf8823c4 chore: improve documentation of lookahead (LLFourn)
bc796f412acdc3d2cd96f7aec0f24fa47c1fe889 fix(example): bitcoind_rpc_polling now initializes local_chain properly (志宇)
4fd539b6470f7f771e3b5e09e3287952fa7a1825 feat(chain)!: `KeychainTxOutIndex` uses a universal lookahead (Antoine Poinsot)

Pull request description:

  ### Description

  The `bdk::Wallet` is currently created without setting any lookahead value for the keychain. This implicitly makes it a lookahead of 0. As this is a high-level interface we should avoid footguns and aim for a reasonable default.

  To fix this, we have also decided to change `KeychainTxOutIndex` to have a default lookahead. Additionally, we have simplified the `KeychainTxOutIndex` API to have a single `lookahead` that is ONLY set at construction `KeychainTxOutIndex::new(lookahead: u32) -> Self`. This avoids the footguns of having methods which allows the caller to decrease the `lookahead` (which will panic).

  ### Notes to the reviewers

  ~A way to set this value externally is introduced in #1172. This PR only aims to use a saner default than 0. `1_000` is the value used by the Bitcoin Core wallet, and that seems reasonable to me.~

  Edit: we should NOT allow setting the `lookahead` value after-the-fact. Instead, the `lookahead` should be provided to the wallet's constructor.

  @evanlinjin: I don't think additional tests are necessary as no additional features are added, and the surface area of the API is decreased. The original tests already thoroughly test the `lookahead` concept.

  ### Checklists

  #### All Submissions:

  *(This section was updated as this PR changed from being a simple setting to introducing a new method.)*

  * [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
  ~* [ ] I've added tests~
  * [x] I've added docs

ACKs for top commit:
  LLFourn:
    ACK 1def76f1f17fc876534c798883099c58de57c0fd

Tree-SHA512: b4c3be8a4f2ac4877cf3f05852147e7dd1daeb02d3bc40895f02fd2a58e584f1dc0735b524153ff0875380ac93c0b4c31e516873d7a9b0027fdbbb5fe7970ff2

23 months agochore: make clippy happy and bump clippy msrv
志宇 [Fri, 29 Dec 2023 11:15:57 +0000 (19:15 +0800)]
chore: make clippy happy and bump clippy msrv

23 months agochore: improve documentation of lookahead
LLFourn [Fri, 29 Dec 2023 05:40:48 +0000 (16:40 +1100)]
chore: improve documentation of lookahead

23 months agofix(example): bitcoind_rpc_polling now initializes local_chain properly
志宇 [Thu, 28 Dec 2023 04:49:04 +0000 (12:49 +0800)]
fix(example): bitcoind_rpc_polling now initializes local_chain properly

Previously, the genesis block is not initialized properly. Thank you
@notmandatory for identifying this bug.

23 months agofeat(chain)!: `KeychainTxOutIndex` uses a universal lookahead
Antoine Poinsot [Tue, 28 Nov 2023 17:08:49 +0000 (18:08 +0100)]
feat(chain)!: `KeychainTxOutIndex` uses a universal lookahead

The wallet is currently created without setting any lookahead value for
the keychain. This implicitly makes it a lookahead of 0. As this is a
high-level interface we should avoid footguns and aim for a reasonable
default.

Instead of simply patching it for wallet, we alter `KeychainTxOutIndex`
to have a default lookahead value. Additionally, instead of a
per-keychain lookahead, the constructor asks for a `lookahead` value.
This avoids the footguns of having methods which allows the caller the
decrease the `lookahead` (and therefore panicing). This also simplifies
the API.

Co-authored-by: Antoine Poisot <darosior@protonmail.com>
Co-authored-by: 志宇 <hello@evanlinjin.me>
23 months agoMerge bitcoindevkit/bdk#1246: Fix: apply loaded changeset to indexed_graph when loadi...
志宇 [Tue, 26 Dec 2023 04:13:42 +0000 (12:13 +0800)]
Merge bitcoindevkit/bdk#1246: Fix: apply loaded changeset to indexed_graph when loading a wallet from persistence

f4863c6314904ddd5da586fed0abb8f04ccee396 fix(wallet): apply loaded changeset to indexed_graph (thunderbiscuit)

Pull request description:

  ### Description
  This PR applies the tx_graph from the changeset when loading a wallet from persistence. This ensures among other things that the revealed keychain indices get picked up by the new wallet. A test for this has been added/modified from an old test.

  ### Notes to the reviewers

  ### Changelog notice
  Fix: loading a wallet from persistence now restores keychain indices.

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

ACKs for top commit:
  evanlinjin:
    ACK f4863c6314904ddd5da586fed0abb8f04ccee396

Tree-SHA512: c8502077ba25e6fb953829b020b396774aa0569f7272e7818f30ddabed9d1d8ce791729bebc92b9ec1059028399495cb79ea147cf900f25aace94045dd7290a6

2 years agofix(wallet): apply loaded changeset to indexed_graph
thunderbiscuit [Tue, 19 Dec 2023 21:05:01 +0000 (16:05 -0500)]
fix(wallet): apply loaded changeset to indexed_graph

2 years agoMerge bitcoindevkit/bdk#1247: ci: pin home dependency to 0.5.5 and check_clippy to...
志宇 [Thu, 21 Dec 2023 02:41:46 +0000 (10:41 +0800)]
Merge bitcoindevkit/bdk#1247: ci: pin home dependency to 0.5.5 and check_clippy to rust stable version

e7fbc8bcf36de110e88095dba8be0c62e2c8e0ef ci: run clippy_check with rust stable (Steve Myers)
2251b8d41661deb5d8ef7b98abef55efe6437180 ci: pin home version to 0.5.5 for 1.63 MSRV (Steve Myers)

Pull request description:

  ### Description

  Fixed 1.63 MSRV error by pinning `home` dependency to `0.5.5`, and `clippy` error by changing `check_clippy` job to using rust `stable` version.

  ### Notes to the reviewers

  It's OK to use rust `stable` version for clippy because we already have a `clippy.toml` file to tell it which version of the clippy rules to check against.

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

Tree-SHA512: 4e9e12488d44a940ea80ecc32ae74dade13d04d5088cb2206271401a2d77b56407af36482df952354b187a52b83631dcdf53bd60d9084a910f4be278059df93b

2 years agoci: run clippy_check with rust stable
Steve Myers [Wed, 20 Dec 2023 17:23:34 +0000 (11:23 -0600)]
ci: run clippy_check with rust stable

2 years agoci: pin home version to 0.5.5 for 1.63 MSRV
Steve Myers [Wed, 20 Dec 2023 17:19:48 +0000 (11:19 -0600)]
ci: pin home version to 0.5.5 for 1.63 MSRV

2 years agoMerge bitcoindevkit/bdk#1188: doc: Improve TxGraph & co docs
Steve Myers [Wed, 13 Dec 2023 22:53:55 +0000 (16:53 -0600)]
Merge bitcoindevkit/bdk#1188: doc: Improve TxGraph & co docs

0adff9c35f109a15740212b4dce74c03950c85ed doc: Improve TxGraph & co docs (Daniela Brozzoni)

Pull request description:

  ### 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:
    Re-ACK 0adff9c35f109a15740212b4dce74c03950c85ed

Tree-SHA512: 83adffeddf6c8ddb7b5e57a0fa2e5cffaf75cdeea59be0a6c5e94dcd5a7f98328db8e2a620edc753e60ea3382282908c75d34783a280348cfd105a37982c762b

2 years agodoc: Improve TxGraph & co docs
Daniela Brozzoni [Tue, 17 Oct 2023 09:00:05 +0000 (11:00 +0200)]
doc: Improve TxGraph & co docs

2 years agoMerge bitcoindevkit/bdk#1183: Bump MSRV to 1.63.0
Steve Myers [Tue, 12 Dec 2023 02:06:47 +0000 (20:06 -0600)]
Merge bitcoindevkit/bdk#1183: Bump MSRV to 1.63.0

169385bb5ba0fe6ad3ed4fbbad431904582c7eb7 ci: change MSRV to 1.63.0 (Steve Myers)

Pull request description:

  ### Description

  fixes #331

  ### Notes to the reviewers

  We won't merge this PR until LDK merges lightningdevkit/rust-lightning#2681.

  There are alot of clippy checks to fix at 1.63.0 so I left the clippy MSRV at 1.57.0 for now.

  ### Changelog notice

  Changed

  - MSRV is now 1.63.0 for bdk, chain, and bitcoind_rpc crates

  ### Checklists

  #### All Submissions:

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

ACKs for top commit:
  evanlinjin:
    ACK 169385bb5ba0fe6ad3ed4fbbad431904582c7eb7

Tree-SHA512: ad69038173b4f050b57f637fc06a4153cf76929992cfea77e3f25d1e66be102bd2f83a46401a7e3245e9cc54602210c95b75a578f18c5c8b55d1e7229e92197f

2 years agoci: change MSRV to 1.63.0
Steve Myers [Wed, 25 Oct 2023 02:55:19 +0000 (21:55 -0500)]
ci: change MSRV to 1.63.0

2 years agoMerge bitcoindevkit/bdk#1158: doc(bdk): Clarify the absolute_fee docs
Steve Myers [Tue, 5 Dec 2023 13:15:06 +0000 (07:15 -0600)]
Merge bitcoindevkit/bdk#1158: doc(bdk): Clarify the absolute_fee docs

0ecc0280c032301dc638e75e54a8691d66d50274 doc(bdk): Clarify the absolute_fee, fee_rate docs (Daniela Brozzoni)

Pull request description:

  Fixes #1066

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

Tree-SHA512: 152e48b86c21d4fad711abf76dd8fdc0e8955030331005c1ba6ff0c866c52870161f91ec740838f8238c5ad1c620e06212099308a55d130699cb18e4666e3f3f

2 years agoMerge bitcoindevkit/bdk#1179: build(esplora): Add async-https-rustls flag to esplora...
Steve Myers [Tue, 5 Dec 2023 04:21:33 +0000 (22:21 -0600)]
Merge bitcoindevkit/bdk#1179: build(esplora): Add async-https-rustls flag to esplora client

6817ca9bcbff957efb58f96886a30b6bd87c0cde ci: pin hyper-rustls version to 0.24.0 for 1.57 MSRV (thunderbiscuit)
4ee41dbc402121d14ffa099863bf35329851c1e4 build(esplora): Add async-https-rustls flag to esplora client (thunderbiscuit)

Pull request description:

  ### Description
  The bdk_esplora crate currently doesn't expose the [`async-https-rustls` flag offered by the rust-esplora-client](https://github.com/bitcoindevkit/rust-esplora-client/blob/ef1925e1ee1b951f15a9339282858bea27c6168f/Cargo.toml#L44) crate and instead requires users to build using the `default-tls` flag on reqwest, which uses the platform-specific openssl library when compiling. This creates complications for cross-compilation, notably for our Android builds that currently support 3 architectures (`arm64-v8a`, `armeabi-v7a`, and `x86_64`). In order to solve this we can either compile the openssl libraries for each of the platforms we want to support, or use the rustls-tls version of reqwest. The second options is much easier and requires less fiddling with the internals of the Android native development kit and cross-compilation rabbit holes.

  Before we merge this I want to make sure I understand the tradeoffs between the `native-tls` and the `rustls-tls` and confirm that there are not potential issues there, but from what I understand they should provide the same functionality/security, and because these are already available/exposed in reqwest and rust-esplora-client, I think this should be a fairly straightforward additional feature we offer.

  ### Changelog notice
  ```txt
  Added:
    - New async-https-rustls feature flag for the bdk_esplora crate, allowing to compile rust-esplora-client using rustls-tls instead of the default native-tls.
  ```

  ### 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 6817ca9bcbff957efb58f96886a30b6bd87c0cde
  realeinherjar:
    ACK https://github.com/bitcoindevkit/bdk/commit/6817ca9bcbff957efb58f96886a30b6bd87c0cde
  danielabrozzoni:
    ACK 6817ca9bcbff957efb58f96886a30b6bd87c0cde

Tree-SHA512: 1d417da7cf85e157d71f56442a06e817e8741822d7bff9089f7fbb70ff8b4854f1f52befbc348b849e9c98cae848b792d426cd5bf551e7a9089b15467d28efdd

2 years agoMerge bitcoindevkit/bdk#1225: esplora: fix incorrect gap limit check in blocking...
志宇 [Mon, 27 Nov 2023 01:40:31 +0000 (09:40 +0800)]
Merge bitcoindevkit/bdk#1225: esplora: fix incorrect gap limit check in blocking client

43aed386bc33f8dfca53ea2ec166dea1ce3d42d3 esplora: also test the gap limit bounds in the async client (Antoine Poinsot)
cb713e5b8c74181518e8cfcd4095c862bc73f014 esplora: also fix the gap limit check in the async client (Antoine Poinsot)
2c4e90a76fea51cb7381242f55b1ca0f02e20d4e esplora: scan gap limit bounds testing (Antoine Poinsot)
18bd3296170e64aee6870cd96dde52a0078bbcb1 esplora: fix incorrect gap limit check in blocking client (Antoine Poinsot)

Pull request description:

  The gap limit was checked such as if the last_index was not None but the last_active_index was, we'd consider having reached it. But the last_index is never None for this check. This effectively made it so the gap limit was always 1: if the first address isn't used last_active_index will be None and we'd return immediately.

  Fix this by avoiding error-prone Option comparisons and correctly checking we've reached the gap limit before breaking out of the loop.

ACKs for top commit:
  danielabrozzoni:
    ACK 43aed386bc33f8dfca53ea2ec166dea1ce3d42d3
  evanlinjin:
    ACK 43aed386bc33f8dfca53ea2ec166dea1ce3d42d3

Tree-SHA512: c6a172e0627380add56aec79e7fe36c0358e092b59f0bea8885d3524e65c10336291943efe6aeb5cc83f90c4f2146ed63215e56e08583d703b6ab57284487f03

2 years agoesplora: also test the gap limit bounds in the async client
Antoine Poinsot [Mon, 20 Nov 2023 11:00:50 +0000 (12:00 +0100)]
esplora: also test the gap limit bounds in the async client

2 years agoesplora: also fix the gap limit check in the async client
Antoine Poinsot [Mon, 20 Nov 2023 11:00:31 +0000 (12:00 +0100)]
esplora: also fix the gap limit check in the async client

2 years agoesplora: scan gap limit bounds testing
Antoine Poinsot [Mon, 20 Nov 2023 10:52:30 +0000 (11:52 +0100)]
esplora: scan gap limit bounds testing

2 years agoesplora: fix incorrect gap limit check in blocking client
Antoine Poinsot [Mon, 20 Nov 2023 09:34:10 +0000 (10:34 +0100)]
esplora: fix incorrect gap limit check in blocking client

The gap limit was checked such as if the last_index was not None but the
last_active_index was, we'd consider having reached it. But the
last_index is never None for this check. This effectively made it so the
gap limit was always 1: if the first address isn't used
last_active_index will be None and we'd return immediately.

Fix this by avoiding error-prone Option comparisons and correctly
checking we've reached the gap limit before breaking out of the loop.

2 years agoMerge bitcoindevkit/bdk#1190: Add `Wallet::list_output` method
Daniela Brozzoni [Tue, 21 Nov 2023 15:53:50 +0000 (16:53 +0100)]
Merge bitcoindevkit/bdk#1190: Add `Wallet::list_output` method

278210bb8918923005e80968df3dfcc3372c0a5c docs(bdk): clarify `insert_txout` docs (志宇)
6fb45d8a735ec8db9142489d86107de192e0fa9c test(bdk): add `test_list_output` (志宇)
e803ee901002cae4db5ebf3544eb42c6cf81e5e2 feat(bdk): add `Wallet::list_output` method (志宇)
82632897aaa4ea0ac24803f58fbd13d6dc9c4357 refactor(bdk)!: rename `LocalUtxo` to `LocalOutput` (志宇)

Pull request description:

  Fixes #1184

  ### Description

  Introduce `Wallet::list_output` method that lists all outputs (both spent and unspent) in a consistent history.

  ### Changelog notice

  - Rename `LocalUtxo` to `LocalOutput`.
  - Add `Wallet::list_output` 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

ACKs for top commit:
  notmandatory:
    re-ACK 278210bb8918923005e80968df3dfcc3372c0a5c
  danielabrozzoni:
    ACK 278210bb8918923005e80968df3dfcc3372c0a5c

Tree-SHA512: 151af0e05e55d9c682271ef0c7a82e189531db963f65aa62c2ba0507f203dde39ab7561521c56e72c26830828e94ff96b7bd7e3f46082b23f79c5e0f89470136

2 years agoci: pin hyper-rustls version to 0.24.0 for 1.57 MSRV
thunderbiscuit [Tue, 21 Nov 2023 01:02:31 +0000 (20:02 -0500)]
ci: pin hyper-rustls version to 0.24.0 for 1.57 MSRV

2 years agoMerge bitcoindevkit/bdk#1204: chore: remove bdk dependency on log and dev dependency...
Steve Myers [Mon, 20 Nov 2023 23:33:48 +0000 (15:33 -0800)]
Merge bitcoindevkit/bdk#1204: chore: remove bdk dependency on log and dev dependency on env_logger

02fa34089623ea43e9c62003e3b829d10dec5a14 chore: remove bdk dependency on log and dev dependency on env_logger (Steve Myers)

Pull request description:

  ### Description

  As suggested by @TheBlueMatt we shouldn't use the `log` crate because even though it is a rust-lang project is may depend on some other crates that aren't as well maintained. Since we were only use `log` in a few places and not it any other bdk workspace projects except the `bdk` package I removed it.

  ### Notes to the reviewers

  For consistency I also removed the `env_logger` from the dev dependencies since it was only being used in a few places in a couple examples and println! is adequate for examples.

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

Top commit has no ACKs.

Tree-SHA512: beb9e4d465112090093590c45e3e5e2286a99a819312512eb3e5b40d0eade9740314bb8e45a2ad3fa0a4c86e32711d2ef8f966842815874b9315fd0b63bc7283

2 years agochore: remove bdk dependency on log and dev dependency on env_logger
Steve Myers [Sat, 11 Nov 2023 19:02:02 +0000 (13:02 -0600)]
chore: remove bdk dependency on log and dev dependency on env_logger

2 years agobuild(esplora): Add async-https-rustls flag to esplora client
thunderbiscuit [Mon, 16 Oct 2023 16:56:19 +0000 (12:56 -0400)]
build(esplora): Add async-https-rustls flag to esplora client

2 years agodocs(bdk): clarify `insert_txout` docs
志宇 [Mon, 20 Nov 2023 21:06:53 +0000 (05:06 +0800)]
docs(bdk): clarify `insert_txout` docs

Inserted txouts will not be shown in `list_unspent` or `list_output`.

2 years agotest(bdk): add `test_list_output`
志宇 [Wed, 1 Nov 2023 20:24:25 +0000 (04:24 +0800)]
test(bdk): add `test_list_output`

2 years agofeat(bdk): add `Wallet::list_output` method
志宇 [Wed, 1 Nov 2023 05:25:28 +0000 (13:25 +0800)]
feat(bdk): add `Wallet::list_output` method

2 years agorefactor(bdk)!: rename `LocalUtxo` to `LocalOutput`
志宇 [Wed, 1 Nov 2023 04:33:57 +0000 (12:33 +0800)]
refactor(bdk)!: rename `LocalUtxo` to `LocalOutput`

2 years agoMerge bitcoindevkit/bdk#1028: Add CreateTxError and use as error type for TxBuilder...
Steve Myers [Thu, 16 Nov 2023 18:30:16 +0000 (12:30 -0600)]
Merge bitcoindevkit/bdk#1028: Add CreateTxError and use as error type for TxBuilder::finish()

00ec19ef2d59b6268424105f3d1947ab637b8c0c ci: fix MSRV pinning for rustls 0.21.9 (Steve Myers)
77f9977c02683071748f5fd6d07bde4b2d1f4a12 feat(wallet): Add infallible Wallet get_address(), get_internal_address functions (Steve Myers)
9e7d99e3bf9687251930c9a6bc5f1fe6a7c78bcb refactor(bdk)!: add context specific error types, remove top level error mod (Steve Myers)

Pull request description:

  ### Description

  To remove some places where there were `.expect("TODO")` I added a new `CreateTxError` type which is returned from `TxBuilder::finish()`. I also updated related tests and doc tests.

  Fixes https://github.com/bitcoindevkit/bdk/issues/996#issuecomment-1621036206

  Also added fallible `Wallet::try_get_address()` and `try_get_internal_address()`  to return `Result` with a possible `D:WriteError` when a PersistBackend is used. This should fix #996.

  I removed catch-all bdk::Error and replaced usages with new types and updated related functions, fixes #994.

  ### Notes to the reviewers

  ~~I didn't add all possible bdk::Error types that `Wallet::create_tx()` and `TxBuilder::finish()` functions might throw. It's probably not too much more work but will take a bit more research so I want to make sure this is the right general approach first.~~

  I added `anyhow` to the dev-dependencies so I could remove some `.expect()` lines from the docs tests and make the examples closer to what an end user should do.  I also used the `anyhow!()` macro to replace a few places that were using the `bdk::Error::Generic` in example code.

  I also moved the module level error.rs file to wallet/error.rs so no one would be tempted to make any new catch all errors and to make it clear that all the errors in it are wallet module related.

  ### Changelog notice

  Changed

  - Updated bdk module to use new context specific error types
    - wallet: MiniscriptPsbtError, CreateTxError, BuildFeeBumpError error enums
    - coin_selection: module Error enum
  - Renamed fallible Wallet address functions to try_get_address() and try_get_internal_address()

  Removed

  - Removed catch-all top level bdk::Error enum
  - Removed impl_error macro

  Added

  -  Added infallible Wallet get_address(), get_internal_address functions

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

Top commit has no ACKs.

Tree-SHA512: a87c0856d71f9c945d12b6de6d368f49bd62d73886ac46ac83d00ddb81f2c38c5233ba053e40c76dea73ee7bfc19dac510eec5d7c9026ae50a2dc7308ac4786f

2 years agoci: fix MSRV pinning for rustls 0.21.9
Steve Myers [Thu, 16 Nov 2023 17:56:09 +0000 (11:56 -0600)]
ci: fix MSRV pinning for rustls 0.21.9

2 years agofeat(wallet): Add infallible Wallet get_address(), get_internal_address functions
Steve Myers [Thu, 16 Nov 2023 17:18:11 +0000 (11:18 -0600)]
feat(wallet): Add infallible Wallet get_address(), get_internal_address functions

refactor!(wallet)!: rename fallible Wallet try_get_address(), try_get_internal_address functions

2 years agorefactor(bdk)!: add context specific error types, remove top level error mod
Steve Myers [Thu, 16 Nov 2023 16:22:37 +0000 (10:22 -0600)]
refactor(bdk)!: add context specific error types, remove top level error mod

refactor(bdk)!: remove impl_error macro
refactor(wallet)!: add MiniscriptPsbtError, CreateTxError, BuildFeeBumpError error enums
refactor(coin_selection)!: add module Error enum
test(bdk): use anyhow dev-dependency for all tests

2 years agoMerge bitcoindevkit/bdk#1220: chore: fix typos and remove unused speculos dockerfiles
Daniela Brozzoni [Thu, 16 Nov 2023 13:31:52 +0000 (14:31 +0100)]
Merge bitcoindevkit/bdk#1220: chore: fix typos and remove unused speculos dockerfiles

27a63abd1e7c87aaf3e07f8023370887a270c61a chore: typos fixed (Einherjar)

Pull request description:

  ### Description

  Fixes the typos and remove unused speculos dockerfiles that was done in #1165.
  Moving these changes into this PR to be merged first.
  Then, we can rebase #1165 and make it only related to CI and Nix.
  (Maybe do a big squash 😄)

  ## Note to Reviewers

  About the speculos stuff, we are not using them, removed in #793,
  more specifically in 3f5a78ae3b1e6c3f0a6acc98bb2445c895cfd743.

  ### Changelog notice

  - Fix typos in codebase and docs
  - Remove unused CI tests with hardware signer Dockerfiles

  ### 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:
  danielabrozzoni:
    ACK 27a63abd1e7c87aaf3e07f8023370887a270c61a

Tree-SHA512: a01101d0741e2b0e1d1254b5cae670c5a936bb0b89332c102feb57d58d2b9ae995ed4436068b0dc5fae73dbe22431c3143d6e04cdc12eab991bd726cfd2fbe25

2 years agochore: typos fixed
Einherjar [Fri, 20 Oct 2023 20:37:28 +0000 (17:37 -0300)]
chore: typos fixed

2 years agoMerge bitcoindevkit/bdk#1178: `LocalChain` with hardwired genesis block
Steve Myers [Thu, 16 Nov 2023 00:04:08 +0000 (18:04 -0600)]
Merge bitcoindevkit/bdk#1178: `LocalChain` with hardwired genesis block

f1b112e8f9563c2afb9097911ee5e1afbbc55d22 docs(bitcoind_rpc): update docs for `Emitter::new` (志宇)
9a250baf6203a077fcfc03c3f6b386d5fba03d60 chore: make clippy happy (志宇)
79b84bed0ec399a375490c2c0f16c6ea3f5969b6 feat(bdk): changeset's `Append` impl checks that network is consistent (志宇)
06a956ad20ca5f1dcd108e45a1a1fed924128cdb feat!: change `load_from_persistence` to return an option (志宇)
c3265e2514070bd4da92ca343fe884e13e831360 test(bdk): add tests for wallet constructor methods (志宇)
96f1d94e2c8378d820a59e5ceafe686477243bf8 test(file_store): add construction method tests (志宇)
1886dc4fe743408132c3257afc1cacbb4d964105 chore(examples): use `Wallet::new_or_load` method where appropriate (志宇)
24994a3ed47aacf203ca0b456eb22f4b93ec58a8 feat(file_store)!: have separate methods for creating and opening Store (志宇)
d294e2e3189dc14efe5b9916cf83f5e7f8592c64 feat(wallet)!: add `new_or_load` methods (志宇)
7c6cbc4d9f7349e769594151936b3e2947b79d00 chore(file_store): rm empty test file (志宇)
6cf3963c6cfeacc8cd9d59bdb0bafded5022baaf feat(bdk)!: have separate methods for creating and loading `Wallet` (志宇)
7d5f31f6cc323241e866c136656f9674e0bf7c53 feat(chain, file_store): add `is_empty` method to `PersistBackend` trait (志宇)
5998a228191caccfaeac2b38ed4f319994b944c1 feat!: `LocalChain` with hardwired genesis checkpoint (志宇)

Pull request description:

  closes #1079
  closes #1107

  ### Description

  Many methods of `TxGraph` require a `chain_tip: BlockId` input to use against a `ChainOracle` implementation. This is used to ask the `ChainOracle` implementation whether a certain block exists in the chain identified by the `chain_tip`. This guarantees that the `TxGraph` methods will return a consistent history of transactions.

  However, the `ChainOracle` trait's `get_chain_tip` method returns an option of `BlockId`. It becomes unclear what to do when `get_chain_tip` returns `None`.

  This PR changes the `ChainOracle::get_chain_tip` method to always return a `BlockId` (no `Option`). `LocalChain` now hardwires the genesis block in order to implement `ChainOracle`.

  `bdk::Wallet` and `bdk_file_store::Store` are changed to have separate constructor methods for initializing a fresh instance and recovering a previous instance from persistence.

  ### Notes to the reviewers

  ### Changelog notice

  - Changed `ChainOracle::get_chain_tip` method to return a `BlockId` instead of an `Option` of a `BlockId`.
  - Refactored `LocalChain` so that the genesis `BlockId` is hardwired. This way, the `ChainOracle::get_chain_tip` implementation can always return a tip.
  - Add `is_empty` method to `PersistBackend`. This returns true when there is no data in the persistence.
  - Changed `Wallet::new` to initialize a fresh wallet only.
  - Added `Wallet::load` to restore an instance of a wallet.
  - Replaced `Store::new` with separate methods to create/open the database file.

  ### Checklists

  #### All Submissions:

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

  #### New Features:

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

Top commit has no ACKs.

Tree-SHA512: 31b75fb53cc451f1fce7e409f1112c43973db7e8b5b31640e01e5b52089683b60320565427d6ea0478ff4c8680dbdb9272fdab08aef69d30f257da52e731e1a3

2 years agodocs(bitcoind_rpc): update docs for `Emitter::new`
志宇 [Wed, 15 Nov 2023 23:23:56 +0000 (07:23 +0800)]
docs(bitcoind_rpc): update docs for `Emitter::new`

2 years agochore: make clippy happy
志宇 [Wed, 15 Nov 2023 23:17:16 +0000 (07:17 +0800)]
chore: make clippy happy

2 years agofeat(bdk): changeset's `Append` impl checks that network is consistent
志宇 [Mon, 6 Nov 2023 03:52:03 +0000 (11:52 +0800)]
feat(bdk): changeset's `Append` impl checks that network is consistent

2 years agofeat!: change `load_from_persistence` to return an option
志宇 [Wed, 1 Nov 2023 01:21:24 +0000 (09:21 +0800)]
feat!: change `load_from_persistence` to return an option

`PersistBackend::is_empty` is removed. Instead, `load_from_persistence`
returns an option of the changeset. `None` means persistence is empty.
This is a better API than a separate method. We can now differentiate
between a persisted single changeset and nothing persisted.

`Store::aggregate_changeset` is refactored to return a `Result` instead
of a tuple. A new error type (`AggregateChangesetsError`) is introduced
to include the partially-aggregated changeset in the error. This is a
more idiomatic API.

2 years agotest(bdk): add tests for wallet constructor methods
志宇 [Mon, 30 Oct 2023 22:46:27 +0000 (06:46 +0800)]
test(bdk): add tests for wallet constructor methods

2 years agotest(file_store): add construction method tests
志宇 [Mon, 30 Oct 2023 10:02:44 +0000 (18:02 +0800)]
test(file_store): add construction method tests

2 years agochore(examples): use `Wallet::new_or_load` method where appropriate
志宇 [Mon, 30 Oct 2023 03:38:20 +0000 (11:38 +0800)]
chore(examples): use `Wallet::new_or_load` method where appropriate

2 years agofeat(file_store)!: have separate methods for creating and opening Store
志宇 [Mon, 30 Oct 2023 03:02:50 +0000 (11:02 +0800)]
feat(file_store)!: have separate methods for creating and opening Store

2 years agofeat(wallet)!: add `new_or_load` methods
志宇 [Fri, 27 Oct 2023 06:14:25 +0000 (14:14 +0800)]
feat(wallet)!: add `new_or_load` methods

These methods try to load wallet from persistence and initializes the
wallet instead if non-existant.

An internal helper method `create_signers` is added to reuse code.
Documentation is also improved.

2 years agochore(file_store): rm empty test file
志宇 [Thu, 26 Oct 2023 00:12:09 +0000 (08:12 +0800)]
chore(file_store): rm empty test file

2 years agofeat(bdk)!: have separate methods for creating and loading `Wallet`
志宇 [Wed, 25 Oct 2023 22:20:37 +0000 (06:20 +0800)]
feat(bdk)!: have separate methods for creating and loading `Wallet`

`Wallet::new` now creates a new wallet. `Wallet::load` loads an existing
wallet. The network type is now recoverable from persistence. Error
types have been simplified.

2 years agofeat(chain, file_store): add `is_empty` method to `PersistBackend` trait
志宇 [Wed, 25 Oct 2023 23:47:29 +0000 (07:47 +0800)]
feat(chain, file_store): add `is_empty` method to `PersistBackend` trait

2 years agofeat!: `LocalChain` with hardwired genesis checkpoint
志宇 [Thu, 12 Oct 2023 08:55:32 +0000 (16:55 +0800)]
feat!: `LocalChain` with hardwired genesis checkpoint

This ensures that `LocalChain` will always have a tip. The `ChainOracle`
trait's `get_chain_tip` method no longer needs to return an option.

2 years agoMerge commit 'refs/pull/1121/head' of github.com:bitcoindevkit/bdk
Steve Myers [Tue, 14 Nov 2023 17:51:48 +0000 (11:51 -0600)]
Merge commit 'refs/pull/1121/head' of github.com:bitcoindevkit/bdk

2 years agofeat: add dependabot
Einherjar [Tue, 12 Sep 2023 15:28:37 +0000 (12:28 -0300)]
feat: add dependabot

Fixes #1118.
Adds `dependabot.yml` to `.github/` to check for `"github-action"`
updates on a `"weekly"` basis.
This does not touch Rust code or Cargo workflows.

It will  create PRs and we would need to approve them
(they would be subject to the same merge policy)
to instantiate the proposed dependabots into `master`.

2 years agoMerge bitcoindevkit/bdk#1202: fix(chain): filter coinbase tx not in best chain
Daniela Brozzoni [Tue, 14 Nov 2023 13:56:56 +0000 (14:56 +0100)]
Merge bitcoindevkit/bdk#1202: fix(chain): filter coinbase tx not in best chain

991cb77b6fbeedbf52d1bd9aa6b3d680f8269969 fix(chain): filter coinbase tx not in best chain (Wei Chen)

Pull request description:

  ### Description

  Fixes #1144.
  Coinbase transactions cannot exist in the mempool and be unconfirmed. `TxGraph::try_get_chain_position` should always return `None` for coinbase transactions not anchored in best chain.

  ### 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:
  notmandatory:
    ACK 991cb77b6fbeedbf52d1bd9aa6b3d680f8269969
  danielabrozzoni:
    ACK 991cb77b6fbeedbf52d1bd9aa6b3d680f8269969

Tree-SHA512: 9e06d8404708eee050c96807a876a470303f4983666c82c56c17d97c2d4b72784e75271279fd393c53a6a967a352aea1ef2762da71ac4bb58f7a0c2f05354948

2 years agoMerge bitcoindevkit/bdk#1206: chore: rename `ConfirmationTimeAnchor` to `Confirmation...
Daniela Brozzoni [Tue, 14 Nov 2023 13:48:24 +0000 (14:48 +0100)]
Merge bitcoindevkit/bdk#1206: chore: rename `ConfirmationTimeAnchor` to `ConfirmationTimeHeightAnchor`

0112c67b6031b55a6c73f797db52d64a1b4ee38a chore: rename `ConfirmationTimeAnchor` to `ConfirmationTimeHeightAnchor` (Wei Chen)

Pull request description:

  ### Description

  Closes #1187.
  An `Anchor` implementation that records both height and time should have both attributes included in the name.

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

Tree-SHA512: 024cbc83c8aca36baeaf2ce36979d62f235ffea7702e7ac8d4e7669cbc1730f7e1469ba78bf3da6c5a14abedbf1a9e832bdd66fdaa154ad2bef29cb187e1c504

2 years agoci: Pin jobserver after cc
Daniela Brozzoni [Mon, 13 Nov 2023 09:15:34 +0000 (10:15 +0100)]
ci: Pin jobserver after cc

Since now only cc depends on jobserver, it should be pinned after we pin cc

2 years agoMerge bitcoindevkit/bdk#1200: fix(bdk): Check if we're using the correct internal...
Daniela Brozzoni [Mon, 13 Nov 2023 09:08:48 +0000 (10:08 +0100)]
Merge bitcoindevkit/bdk#1200: fix(bdk): Check if we're using the correct internal key before signing

e553231eae45dc6d263a1fce2a3a9c46f6af2510 fix(bdk): Check if we're using the correct... ...internal key before signing (Daniela Brozzoni)

Pull request description:

  ### Description

  Fixes #1142

  We would previously sign with whatever x_only_pubkey we had in hand, without first checking if it was the right key or not. This effectively meant that adding multiple taproot PrivateKey signers would produce unbroadcastable transactions.

  ### Changelog notice

  - Fix a bug related to taproot signing with internal keys. We would previously sign with the first private key we had, without checking if it was the correct internal key or not.

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

Tree-SHA512: c4abbcd27935b8ce80a70b6e0843507866e3d075939f0b01504c090929ed96b4b9c6fee599f701e69960a6c86175682cc6d7f8cc4c3fb1d08a74b7563f8ca145

2 years agoMerge bitcoindevkit/bdk#1145: fix(electrum): fixed chain sync issue
Daniela Brozzoni [Mon, 13 Nov 2023 08:35:45 +0000 (09:35 +0100)]
Merge bitcoindevkit/bdk#1145: fix(electrum): fixed chain sync issue

1010efd8d68e886cc46f0ac2f016630b670ea73c fix(electrum): fixed chain sync issue (Wei Chen)

Pull request description:

  ### Description

  This may or may not fix #1125.
  Fixed what appeared to be a logic error in `construct_update_tip` in `electrum_ext.rs` that caused the local chain tip to always be a block behind the newest confirmed block.

  ### 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:
  danielabrozzoni:
    ACK 1010efd8d68e886cc46f0ac2f016630b670ea73c - although I've been able to reproduce the issue in #1125, I'm convinced that this PR fixes at least a bug, as demonstrated in #1171 (yet to be reviewed and merged).

Tree-SHA512: 92790e9072d17be74d2cd24bec3503e1ad5d97f728ee81490eeb09ac3f8d4a3a7e8d9628e943bc801246d5bfd345152c11d5dbe25246f5a57b3118727d3ae315

2 years agochore: rename `ConfirmationTimeAnchor` to `ConfirmationTimeHeightAnchor`
Wei Chen [Sun, 12 Nov 2023 13:31:44 +0000 (21:31 +0800)]
chore: rename `ConfirmationTimeAnchor` to `ConfirmationTimeHeightAnchor`

An `Anchor` implementation that records both height and time should have
both attributes included in the name.

2 years agofix(electrum): fixed chain sync issue
Wei Chen [Tue, 3 Oct 2023 10:06:53 +0000 (18:06 +0800)]
fix(electrum): fixed chain sync issue

Fixed a logic error in `construct_update_tip` in `electrum_ext.rs` that caused
the local chain tip to always be a block behind the newest confirmed block.

2 years agofix(chain): filter coinbase tx not in best chain
Wei Chen [Thu, 9 Nov 2023 21:34:08 +0000 (05:34 +0800)]
fix(chain): filter coinbase tx not in best chain

Coinbase transactions cannot exist in the mempool and be unconfirmed.
`TxGraph::try_get_chain_position` should always return `None` for coinbase
transactions not anchored in best chain.

2 years agofix(bdk): Check if we're using the correct...
Daniela Brozzoni [Wed, 8 Nov 2023 17:16:21 +0000 (18:16 +0100)]
fix(bdk): Check if we're using the correct...
...internal key before signing

Fixes #1142

We would previously sign with whatever x_only_pubkey we had in hand,
without first checking if it was the right key or not. This effectively
meant that adding multiple taproot PrivateKey signers would produce
unbroadcastable transactions.

2 years agoMerge bitcoindevkit/bdk#1109: Further improve unconfirmed tx conflict resolution
Daniela Brozzoni [Thu, 9 Nov 2023 09:06:59 +0000 (10:06 +0100)]
Merge bitcoindevkit/bdk#1109: Further improve unconfirmed tx conflict resolution

afbf83c8b0d5c97495e6ceaa39963415edef6911 chain(fix): conflict resolution for txs with same last_seen (Wei Chen)

Pull request description:

  ### Description

  Fixes #1102. If a conflicting tx has the same `last_seen`, then we check lexicographical sorting of txids.

  ### Notes to the reviewers

  The tests for this fix exist in the `TxTemplate` structure in #1064 which may need to be merged first.

  ### Checklists

  #### All Submissions:

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

ACKs for top commit:
  danielabrozzoni:
    ACK afbf83c8b0d5c97495e6ceaa39963415edef6911

Tree-SHA512: 91b8fbff305b715247501b861ab7ea9e9d9ef99248b05d14e01aacf7e64ad7826f35773e8998cf421dbd04f663714026084c6e817ac5365bce4844c8ea3b7e3f

2 years agodoc(bdk): Clarify the absolute_fee, fee_rate docs
Daniela Brozzoni [Mon, 9 Oct 2023 10:22:42 +0000 (12:22 +0200)]
doc(bdk): Clarify the absolute_fee, fee_rate docs

Fixes #1066

2 years agochain(fix): conflict resolution for txs with same last_seen
Wei Chen [Fri, 1 Sep 2023 09:58:47 +0000 (17:58 +0800)]
chain(fix): conflict resolution for txs with same last_seen

The tx conflict `Scenario` test for unconfirmed txs with the same
last_seen has been amended for its corresponding conflict
resolution bug fix.

2 years agoMerge bitcoindevkit/bdk#1182: chore: fix MSRV for flate2
志宇 [Mon, 6 Nov 2023 03:14:47 +0000 (11:14 +0800)]
Merge bitcoindevkit/bdk#1182: chore: fix MSRV for flate2

95250fc44ed1372e77995d04ac2b380e0cb126a0 ci(chain): downgrade hashbrown dependency to 0.9.1 to fix ahash related MSRV issue (Steve Myers)
f17df1e1338c63cb79b5f9b2223dba347244c432 ci: more fixed dependencies for MSRV 1.57.0 (Vladimir Fomene)

Pull request description:

ACKs for top commit:
  notmandatory:
    ACK 95250fc44ed1372e77995d04ac2b380e0cb126a0
  realeinherjar:
    ACK 95250fc44ed1372e77995d04ac2b380e0cb126a0
  evanlinjin:
    ACK 95250fc44ed1372e77995d04ac2b380e0cb126a0

Tree-SHA512: ad090713d97cf778598bb4acee200d7acbc987fe74964f171cc9939149251bddce9474b750371df26d3f6548780f4db2c17b3fe2cf5f6d627c808d682c929918

2 years agoci(chain): downgrade hashbrown dependency to 0.9.1 to fix ahash related MSRV issue
Steve Myers [Sat, 4 Nov 2023 02:46:25 +0000 (21:46 -0500)]
ci(chain): downgrade hashbrown dependency to 0.9.1 to fix ahash related MSRV issue

2 years agoci: more fixed dependencies for MSRV 1.57.0
Vladimir Fomene [Fri, 13 Oct 2023 17:45:40 +0000 (20:45 +0300)]
ci: more fixed dependencies for MSRV 1.57.0

2 years agochore: add meta data to bitcoind_rpc crate
Steve Myers [Thu, 12 Oct 2023 14:33:34 +0000 (09:33 -0500)]
chore: add meta data to bitcoind_rpc crate

2 years agoBump bdk version to 1.0.0-alpha.2 v1.0.0-alpha.2
Steve Myers [Wed, 11 Oct 2023 22:30:36 +0000 (17:30 -0500)]
Bump bdk version to 1.0.0-alpha.2

Bump bdk_chain to 0.6.0
Bump bdk_electrum to 0.4.0
Bump bdk_esplora to 0.4.0

2 years agoMerge bitcoindevkit/bdk#1164: ref(chain): Rename direct_conflicts_of_tx to direct_con...
Daniela Brozzoni [Tue, 10 Oct 2023 15:16:37 +0000 (17:16 +0200)]
Merge bitcoindevkit/bdk#1164: ref(chain): Rename direct_conflicts_of_tx to direct_conflitcs

d5c87c49a82c5cd3a4558e61fe9984f0ae8c6cb7 ref(chain): Rename direct_conflicts_of_tx to... ...direct_conflitcs (Daniela Brozzoni)
009408d24361235c1d85b7d147983cff7b0fc191 ci: Pin jobserver to 0.1.26 to keep MSRV (Daniela Brozzoni)

Pull request description:

  Fixes #1138

  ### Changelog notice

  - rename `TxGraph::direct_conflicts_of_tx` to `TxGraph::direct_conflicts`

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

Tree-SHA512: 10072c65025d5fcc5d90c61ecba1dad53bcd10929326ab18ddadb21322841203aa5861adc9c5f200bbc57b0fe59dd4859dc3672870a0ad343fd8a660fd8aa40e