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

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

Pull request description:

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

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

  fixes #1243

  ### Notes to the reviewers

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

  ### Changelog notice

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

  ### Checklists

  #### All Submissions:

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

  #### Bugfixes:

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

ACKs for top commit:
  evanlinjin:
    ACK 5840ce473e430de4c4e3698734e9667cc476fee4

Tree-SHA512: 69f022c6f736500590e36880dd2c845321464f89af6a2c67987d1c520f70a298328363cade0f55f270c4e7169e740bd4ada752ec2c75afa02b6a5a851f9030c3

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

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

Pull request description:

  ### Description

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

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

  ### Notes to the reviewers

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

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

  closes #1136

  ### Changelog notice

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

  ### Checklists

  #### All Submissions:

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

ACKs for top commit:
  evanlinjin:
    ACK 475a77219a6e7649c91b7cfeb44871cee9d0f374

Tree-SHA512: 511dab8aa7a65d2b15b160cb4feb96964e8401bb04cda4ef0f0244524bf23a575b3739783a14b90d2dccc984b3f30f5dabfb0a890ffe7c897c2dc23ba301bcaf

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

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

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

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

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

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

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

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

Adopt `bitcoin::FeeRate` throughout

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

Explicitly state that we truncate file for `create_new`

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

This makes clippy happy.

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

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

Pull request description:

  Bump bdk version to 1.0.0-alpha.7

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

  fixes #1364

ACKs for top commit:
  danielabrozzoni:
    ACK fef70d5e8fe1903aa532897e1093b1b972e08055

Tree-SHA512: 94ba5cad102d89122897436390d4ababf49a19cf97f4118c0804b3288955dd591b543d4605268dcc1967f34e523a0c4058b06f9cd74c7e8c4394e902abc17022

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

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

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

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

Pull request description:

  ### Description

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

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

  ### Changelog notice

  Fix `KeychainTxOutIndex::lookahead_to_target`

  ### Checklists

  #### All Submissions:

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

  #### Bugfixes:

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

ACKs for top commit:
  notmandatory:
    ACK b290b2950221578d73c3194a1accfd080f83631a

Tree-SHA512: af50c6af18b6b57494cfa37f89b0236674fa331091d791e858f67b7d0b3a1e4e11e7422029bd6a2dc1c795914cdf6d592a14b42a62ca7c7c475ba6ed37182539

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

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

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

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

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

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

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

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

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

Pull request description:

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

ACKs for top commit:
  danielabrozzoni:
    ACK 2efa299d0486e0b08376a062e86c6ca8e03916da

Tree-SHA512: 6bfe052c22697eb910cf1f3d453e89f4432159fa017b38532d097cdc07b7a7c3b986be658b81e51acdb54cab999345ab463184e80c8eacefc73d77748c018992

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

2647aff4bc030e3b63287d353fb6293ab2f1442c ci: Remove jobserver pin (Daniela Brozzoni)

Pull request description:

ACKs for top commit:
  evanlinjin:
    ACK 2647aff4bc030e3b63287d353fb6293ab2f1442c

Tree-SHA512: bb3821c44a1d4fb7a84b8e548b9545c74b4ae84feca4d434791c041618dc9a2f03d8c3a64183844fb5b19dfbfa1c19716191e9810d443d6ddc449f171317a20e

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

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

It is not needed anymore. Discovered in #1344

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

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

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

Pull request description:

  ### Description
  Fix #1295

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

  #### New Features:

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

  #### Bugfixes:

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

ACKs for top commit:
  evanlinjin:
    ACK 5489f905a434ecc06867603c7c421e3e50d993ca
  LLFourn:
    ACK 5489f905a434ecc06867603c7c421e3e50d993ca

Tree-SHA512: c8327f2e7035a46208eb32c6da1f9f0bc3e8625168450c5b0b39f695268e42b0b9053b6eb97805b116328195d77af7ca9edb1f12206c50513fbe295dded542e7

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

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

Pull request description:

  ### Description

  Fixes #1343

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

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

  ### Checklists

  #### All Submissions:

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

ACKs for top commit:
  danielabrozzoni:
    utACK 83798390108ef37443dbe2d6ec0d35a346e69957

Tree-SHA512: b16a8f88ab66ed78d6f6402d60acfa79b2371a12580a277f9bb3d3df212fb608a8305b6f5082bb280b9a18e209c70be0db38c893fff2f5c1f6085a99e3819479

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

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

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

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

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

Pull request description:

  🙈

  ### Changelog notice

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

  ### Checklists

  #### All Submissions:

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

  #### Bugfixes:

  * [ ] This pull request breaks the existing API
  * [x] I've added tests to reproduce the issue which are now passing

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

Tree-SHA512: b9f1f17fd2ed0f8e2337a8033e1cbd3e9f15b1ad4b32da3f0eb73a30913d6798e7a08d6b297d93bd08c2e1c388226e97648650ac636846b2c7aa95c3bcefbcfd

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

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

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

Pull request description:

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

ACKs for top commit:
  evanlinjin:
    ACK adc95137ac2e52f4d45c4ec778703001c95a362f

Tree-SHA512: 9a588b64afc7e20b35a9abb8c25b8b82858c0f89886320c0fc91f6c61592fccfa7fbaa3020a393b1d5fd79f71302a388255b69cb3726a38a0f2fdab8bb93769c

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

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

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

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

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

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

Pull request description:

  ### Description

  Partially implements #1265.

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

  ### Notes to the reviewers

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

  ### Checklists

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

  #### All Submissions:

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

  #### New Features:

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

ACKs for top commit:
  evanlinjin:
    re-ACK 552f11cb5f66a9366dbc05c801fcae043ebe5b82
  danielabrozzoni:
    ACK 552f11cb5f66a9366dbc05c801fcae043ebe5b82

Tree-SHA512: 752a24ebd0b9ad7952c1b093ecb251473e346c77b860c1a80c73418130189227405a0f0d7652967cf8c7b89994e8c37df96cd52b52b6daff9cc8c88b5194069a

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

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

Pull request description:

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

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

Tree-SHA512: 42c96a58a762fa8737402ebd0132ce20ce0359c996cee9feeecb0b84e6fb73305be1aec9429fb97ba932486f0b35ac5caed7b43656456c5fb053e55330a12d47

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

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

8d93fad778565f44cbcc053c7f51fbc27bebf99a chore: typos (Jose Storopoli)

Pull request description:

  More caught on by Nix CI in #1257.

  ### Checklists

  #### All Submissions:

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

  #### New Features:

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

  #### Bugfixes:

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

ACKs for top commit:
  evanlinjin:
    ACK 8d93fad778565f44cbcc053c7f51fbc27bebf99a
  notmandatory:
    ACK 8d93fad778565f44cbcc053c7f51fbc27bebf99a

Tree-SHA512: 28e0316d457658266b2af1de76b114f87ce7485e386ddecd805dda1266a4e8645612c0fa6bc921c58daa4886558b32b538cccbb1644c96c3bab638dd7c42ee2b

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

More caught on by Nix CI in #1257.

22 months agoAvoid a wildcard match in tx construction
Steven Roose [Fri, 2 Feb 2024 02:02:27 +0000 (02:02 +0000)]
Avoid a wildcard match in tx construction

22 months agotx_builder: Support setting explicit nSequence for foreign inputs
Steven Roose [Fri, 2 Feb 2024 01:24:39 +0000 (01:24 +0000)]
tx_builder: Support setting explicit nSequence for foreign inputs

22 months agoMerge bitcoindevkit/bdk#1186: Clean up clippy allows
志宇 [Wed, 31 Jan 2024 17:18:16 +0000 (01:18 +0800)]
Merge bitcoindevkit/bdk#1186: Clean up clippy allows

1c15cb2f9169bb08a4128c183eeeca80fff97ab7 ref(example_cli): Add new struct Init (vmammal)
89a7ddca7f6ed8c65ed0124774f3a868d08faf68 ref(esplora): `Box` a large `esplora_client::Error` (vmammal)
097d818d4c7fff12d72ce0ef10ceb9b575c154e1 ref(wallet): `Wallet::preselect_utxos` now accepts a `&TxParams` (vmammal)
f11d663b7efb98dd72fed903ade8c5e7af0b5a3a ref(psbt): refactor body of `get_utxo_for` to address `clippy::manual_map` (vmammal)
4679ca1df7209d2b356fbb8cbd675f07756d1301 ref(example_cli): add typedefs to reduce type complexity (vmammal)
64a90192d9d49c3df22d2b5f489ba20222fd941a refactor: remove old clippy allow attributes (vmammal)

Pull request description:

  closes #1127

  There are several instances in the code where we allow clippy lints that would otherwise be flagged during regular checks. It would be preferable to minimize the number of "clippy allow" attributes either by fixing the affected areas or setting a specific configuration in `clippy.toml`. In cases where we have to allow a particular lint, it should be documented why the lint doesn't apply.

  For context see https://github.com/bitcoindevkit/bdk/issues/1127#issuecomment-1784256647 as well as the commit message details.

  One area I'm unsure of is whether `Box`ing a large error in 4fc2216 is the right approach. Logically it makes sense to avoid allocating a needlessly heavy `Result`, but I haven't studied the implications or tradeoffs of such a change.

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

Tree-SHA512: 5fa3796a33678651414e7aad7ef8309b4cbe2a9ab00dce094964b40784edb2f46a44067785d95ea26f4cd88d593420485be94c9b09ac589f632453fbd8c94d85

22 months agoref(example_cli): Add new struct Init
vmammal [Tue, 30 Jan 2024 22:56:51 +0000 (17:56 -0500)]
ref(example_cli): Add new struct Init

for holding the items returned from `example_cli::init`

22 months agoref(esplora): `Box` a large `esplora_client::Error`
vmammal [Sun, 29 Oct 2023 05:02:31 +0000 (01:02 -0400)]
ref(esplora): `Box` a large `esplora_client::Error`

to address `clippy::result_large_err`. Clippy's default large-error-
threshold is 128. `esplora_client::Error` currently has size 272.

22 months agoref(wallet): `Wallet::preselect_utxos` now accepts a `&TxParams`
vmammal [Fri, 10 Nov 2023 15:54:56 +0000 (10:54 -0500)]
ref(wallet): `Wallet::preselect_utxos` now accepts a `&TxParams`

to reduce the number of required function args in order to satisfy
`clippy::too_many_arguments`

22 months agoref(psbt): refactor body of `get_utxo_for` to address `clippy::manual_map`
vmammal [Sun, 29 Oct 2023 03:12:22 +0000 (23:12 -0400)]
ref(psbt): refactor body of `get_utxo_for` to address `clippy::manual_map`

22 months agoref(example_cli): add typedefs to reduce type complexity
vmammal [Sun, 29 Oct 2023 02:53:37 +0000 (22:53 -0400)]
ref(example_cli): add typedefs to reduce type complexity

- Add typedefs to model the result of functions `planned_utxos`
and `init`

- Add new struct `CreateTxChange` to hold any change info
resulting from `create_tx`

These changes help resolve clippy::type_complexity

22 months agorefactor: remove old clippy allow attributes
vmammal [Sun, 29 Oct 2023 02:32:32 +0000 (22:32 -0400)]
refactor: remove old clippy allow attributes

These lints either resolved themselves, or the code has changed such that
they no longer apply, hence they can be removed with no further changes.

`clippy::derivable_impls`
`clippy::needless_collect`
`clippy::almost_swapped`

22 months agoMerge bitcoindevkit/bdk#1307: Bump version to 1.0.0-alpha.5 v1.0.0-alpha.5
Steve Myers [Wed, 31 Jan 2024 16:01:53 +0000 (10:01 -0600)]
Merge bitcoindevkit/bdk#1307: Bump version to 1.0.0-alpha.5

d597f4c761d10966c12ddaf59f4ed0d9ffdac21b Bump version to 1.0.0-alpha.5 (Steve Myers)

Pull request description:

  ### Description

  Bump version to 1.0.0-alpha.5

  bdk_chain to 0.9.0
  bdk_bitcoind_rpc to 0.4.0
  bdk_electrum to 0.7.0
  bdk_esplora to 0.7.0
  bdk_file_store to 0.5.0

  ### Checklists

  #### All Submissions:

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

ACKs for top commit:
  danielabrozzoni:
    ACK d597f4c761d10966c12ddaf59f4ed0d9ffdac21b

Tree-SHA512: 36ba783083441ddd8d209ede35ff46832fd2532f588ddbff0e4e23fb336aff398f8ca612e2bfd5fa214d0f4c14a4dea9147b34724734cc43b752789765e7a447

22 months agoBump version to 1.0.0-alpha.5
Steve Myers [Wed, 31 Jan 2024 15:23:20 +0000 (09:23 -0600)]
Bump version to 1.0.0-alpha.5

bdk_chain to 0.9.0
bdk_bitcoind_rpc to 0.4.0
bdk_electrum to 0.7.0
bdk_esplora to 0.7.0
bdk_file_store to 0.5.0

22 months agoMerge bitcoindevkit/bdk#1306: Implement `ElectrumExt` for all that implements `Electr...
Steve Myers [Wed, 31 Jan 2024 14:59:05 +0000 (08:59 -0600)]
Merge bitcoindevkit/bdk#1306: Implement `ElectrumExt` for all that implements `ElectrumApi`

ce8c617c9d562a54728c6cafc0562a66bae56b3e feat(electrum): impl `ElectrumExt` for all that impl `ElectrumApi` (志宇)

Pull request description:

  ### Description

  Implement `ElectrumExt` for all that implements `ElectrumApi`.

  I realized this while looking into #1171.

  https://github.com/bitcoindevkit/bdk/blob/2196685cca741a249f4a5b53c7609162469714ba/crates/electrum/tests/test_electrum.rs#L54-L55

  Line 55 here should not be necessary.

  ### Changelog notice

  * Changed to implement `ElectrumExt` for all that implements `ElectrumApi`.

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

Tree-SHA512: d95193a9a356a0aa3f467db3b8c7bf2cfdf83afd520f5254721912cfe82355de1198256b90323e51ffdb0bf955ff923a9ceb8b4541d4a5ad2331ff0bf26ab937

22 months agofeat(electrum): impl `ElectrumExt` for all that impl `ElectrumApi`
志宇 [Wed, 31 Jan 2024 14:19:01 +0000 (22:19 +0800)]
feat(electrum): impl `ElectrumExt` for all that impl `ElectrumApi`

22 months agoMerge bitcoindevkit/bdk#1267: Simplify `Esplora::update_local_chain` and add tests
Steve Myers [Wed, 31 Jan 2024 14:32:37 +0000 (08:32 -0600)]
Merge bitcoindevkit/bdk#1267: Simplify `Esplora::update_local_chain` and add tests

c5afbaa95d7bc699981d6fe7f9964a41b7587d5c ci: update zstd-sys version to work with MSRV 1.63 (Steve Myers)
929b5ddb0c2e0dc7c346c08888201ac54efab84d refactor(esplora): better variable naming and docs (志宇)
216648bcfd2c622890bf7f50fb2eaa4396c42ed1 chore(esplora): Clarify consistency guarantees (LLFourn)
63fa710319f231f7f28d92cb49b0399f3250c9da fix(esplora): reuse returned height instead of zipping (志宇)
6f824cf325c6c882b00742d814be1d72602f05a6 test(esplora): introduce test cases for `update_local_chain` (志宇)
f05e8502e69a051af9869be6ba5ad9a376b25fc2 feat(esplora): greatly simplify `update_local_chain` (志宇)

Pull request description:

  Fixes #1199

  ### Description

  After a second look at the `update_local_chain` implementations, it was clear that they were over complicated. This PR simplifies the `EsploraExt::update_local_chain` method(s) of the `bdk_esplora` crate and adds a whole bunch of tests.

  ### Notes to the reviewers

  The description of #1199 is very brief, however @danielabrozzoni mentioned about potentially-problematic logic with `ASSUME_FINAL_DEPTH`. The logic was indeed convoluted and it did not need to be that way. This PR removes the need for `ASSUME_FINAL_DEPTH`.

  ### Changelog notice

  Fixed
  - Simplified `EsploraExt::update_local_chain` logic.

  ### Checklists

  #### All Submissions:

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

  #### Bugfixes:

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

ACKs for top commit:
  evanlinjin:
    ACK c5afbaa95d7bc699981d6fe7f9964a41b7587d5c
  notmandatory:
    utACK c5afbaa95d7bc699981d6fe7f9964a41b7587d5c

Tree-SHA512: f588493a4643f0f68d3181f27adf91793d4e336be6e853a26289e0916ed83169e1067260b75e627f190842f691ec095e668c0b799ca80e7da2849dd28de32754

22 months agoci: update zstd-sys version to work with MSRV 1.63
Steve Myers [Wed, 31 Jan 2024 14:15:37 +0000 (08:15 -0600)]
ci: update zstd-sys version to work with MSRV 1.63

22 months agorefactor(esplora): better variable naming and docs
志宇 [Wed, 31 Jan 2024 07:55:44 +0000 (15:55 +0800)]
refactor(esplora): better variable naming and docs

22 months agoMerge bitcoindevkit/bdk#1279: Filter duplicate coins before coin selection
志宇 [Wed, 31 Jan 2024 08:00:04 +0000 (16:00 +0800)]
Merge bitcoindevkit/bdk#1279: Filter duplicate coins before coin selection

5299db34cb9117ad1b66a6afcb51f6ca7e1f0d95 fix(wallet): filter duplicates before coin selection (志宇)
d9501187ef3c4436b7baedb23a4d4f6b1f46a03d test(wallet): fix tests helpers to generate unique utxos (志宇)

Pull request description:

  Fixes #1240

  ### Description

  We now filter out duplicate coins before calling `CoinSelectionAlgorithm::coin_select`. If a UTXO exists in both `required_utxos` and `optional_utxos`, only the copy in `required_utxos` will be kept.

  Test helper methods are also updated to not create duplicate UTXOs.

  ### Changelog notice

  Fixed

  * Filter out duplicate UTXOs before calling `CoinSelectionAlgorithm::coin_select`. If a UTXO exists in both `required_utxos` and `optional_utxos`, only the copy in `required_utxos` will be kept.

  ### 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:
    utACK 5299db34cb9117ad1b66a6afcb51f6ca7e1f0d95

Tree-SHA512: 9cb5517b7f74f89c06172efc344766b16b3216a25b1ebdd6eb84767a9e103124cead9eb0a7f3b5feb562fbb925517a9bf0404399de74b4e898982a5b3795aa04

22 months agochore(esplora): Clarify consistency guarantees
LLFourn [Tue, 30 Jan 2024 02:57:06 +0000 (13:57 +1100)]
chore(esplora): Clarify consistency guarantees

22 months agofix(wallet): filter duplicates before coin selection
志宇 [Tue, 16 Jan 2024 07:51:15 +0000 (15:51 +0800)]
fix(wallet): filter duplicates before coin selection

22 months agoMerge bitcoindevkit/bdk#1287: doc(store): update doc for `Store::aggregate_changesets`
志宇 [Mon, 29 Jan 2024 12:54:20 +0000 (20:54 +0800)]
Merge bitcoindevkit/bdk#1287: doc(store): update doc for `Store::aggregate_changesets`

3829fc18c7f2d16d2c72852bde4b4b70bff8e370 doc(store): update doc for `Store::aggregate_changesets` (vmammal)

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:
  evanlinjin:
    ACK 3829fc18c7f2d16d2c72852bde4b4b70bff8e370

Tree-SHA512: 55e3dea6db4e023edcd6f12e3c2e8f63c79654b178e01e2fb8b66f3a66399aabedb1d159cd015b78bc2166be6e640e0ed684e3571f2c4f2f6a53fa68d2ef9849

22 months agofix(esplora): reuse returned height instead of zipping
志宇 [Mon, 29 Jan 2024 09:43:41 +0000 (18:43 +0900)]
fix(esplora): reuse returned height instead of zipping

22 months agoMerge bitcoindevkit/bdk#1290: doc(example_cli): add missing cli docs
志宇 [Mon, 29 Jan 2024 09:06:50 +0000 (18:06 +0900)]
Merge bitcoindevkit/bdk#1290: doc(example_cli): add missing cli docs

c4d5f2ccd8435b9c424eec5ba35ba44a3383b04d doc(example_cli): add missing cli docs (vmammal)

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:
  evanlinjin:
    ACK c4d5f2ccd8435b9c424eec5ba35ba44a3383b04d

Tree-SHA512: 43684abbb32570f07e0dc05ed07062bc7969cbe7c4fefe8ae7ebe41ac28aedfbba76ffc801bc4ddb3bf08a940ca81c128376dc3f6c76a04f1391e43c18e0d50b

22 months agoMerge bitcoindevkit/bdk#1299: fix(file_store): rm lifetime from `FileError`
志宇 [Mon, 29 Jan 2024 08:52:00 +0000 (17:52 +0900)]
Merge bitcoindevkit/bdk#1299: fix(file_store): rm lifetime from `FileError`

5611c9e42adb4106f48039e19ab0797b266c7fff fix(file_store): rm lifetime from `FileError` (志宇)

Pull request description:

  ### Description

  The lifetime on the error needed to be the same as the input magic bytes which was annoying.

  ### Changelog notice

  Fixed
  * Remove `bdk_file_store::FileError` lifetime.

  ### Checklists

  #### All Submissions:

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

ACKs for top commit:
  LLFourn:
    ACK 5611c9e42adb4106f48039e19ab0797b266c7fff

Tree-SHA512: 0eca5128c71c9adb10a712d169a2170b8cbb91678f93986957e86b26dbfed3ab19217a136b57328249a13a51cc06e6c424d58683d74a0fa3d29c22af04a95591

22 months agoMerge bitcoindevkit/bdk#1301: Fix `ConfirmationTime` conversion from `ChainPosition`
志宇 [Mon, 29 Jan 2024 08:51:00 +0000 (17:51 +0900)]
Merge bitcoindevkit/bdk#1301: Fix `ConfirmationTime` conversion from `ChainPosition`

e687c27096e1c8f36c3a129dc6d92af9c5d05a30 fix(chain): convert to `ConfirmationTime` fix (志宇)

Pull request description:

  ### Description

  We forgot to include the `last_seen` when converting from `ChainPosition` to `ConfirmationTime`.

  ### Notes to the reviewers

  No brainer.

  ### Changelog notice

  * Fix `ConfirmationTime` conversion from `ChainPosition` to include the `last_seen`.

  ### Checklists

  #### All Submissions:

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

ACKs for top commit:
  LLFourn:
    ACK e687c27096e1c8f36c3a129dc6d92af9c5d05a30

Tree-SHA512: 182f804309c7ea7f2a42911bc00d836ef48a8617c156b2275d6908b07f619b2466039f54728dd3ca2552f4cd11528a8733618f4ce6a4c88d7e88a05a3d82ffaf

22 months agoMerge pull request #1296 from yukibtc/change-default-lookahead
Lloyd Fournier [Mon, 29 Jan 2024 08:19:49 +0000 (19:19 +1100)]
Merge pull request #1296 from yukibtc/change-default-lookahead

chain: set `DEFAULT_LOOKAHEAD` to 25

22 months agofix(chain): convert to `ConfirmationTime` fix
志宇 [Mon, 29 Jan 2024 08:14:23 +0000 (17:14 +0900)]
fix(chain): convert to `ConfirmationTime` fix

We forgot to include the `last_seen` when converting from
`ChainPosition` to `ConfirmationTime`.

22 months agofix(file_store): rm lifetime from `FileError`
志宇 [Thu, 25 Jan 2024 15:39:59 +0000 (00:39 +0900)]
fix(file_store): rm lifetime from `FileError`

The lifetime on the error needed to be the same as the input magic bytes
which was annoying.

22 months agoMerge bitcoindevkit/bdk#1270: Improve performance of `bdk_file_store::EntryIter`
志宇 [Thu, 25 Jan 2024 14:49:51 +0000 (23:49 +0900)]
Merge bitcoindevkit/bdk#1270: Improve performance of `bdk_file_store::EntryIter`

51bd01b3dd3d68c1628d74be9dc6d0f1cf1f15fe fix(file_store): recover file offset after read (志宇)
66dc34e75ab1ec2ae533bd540327721f6226eca1 refactor(file_store): Use BufReader but simplify (LLFourn)
c8717646700bdac0f1e13ec499481bd1fee30ffd test(file_store): `last_write_is_short` (志宇)
a3aa8b6682a3a13958fd5fbadc4074a1907a78db feat(file_store)!: optimize `EntryIter` by reducing syscalls (志宇)

Pull request description:

  ### Description

  `EntryIter` performance is improved by reducing syscalls. The underlying file reader is wrapped with `BufReader` (to reduce calls to `read` and `seek`).

  Two new tests are introduced. One ensures correct behavior when the last changeset write is too short. The other ensures the next write position is correct after a short read.

  ### Notes to the reviewers

  This is extracted from #1172 as suggested by https://github.com/bitcoindevkit/bdk/pull/1172#pullrequestreview-1817465627.

  ### Changelog notice

  Changed
  * `EntryIter` performance is improved by reducing syscalls.

  ### Checklists

  #### All Submissions:

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

  #### New Features:

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

ACKs for top commit:
  LLFourn:
    ACK 51bd01b3dd3d68c1628d74be9dc6d0f1cf1f15fe

Tree-SHA512: 9c25f9f2032cb2d551f3fe4ac62b856ceeb69a388f037b34674af366c55629a2eaa2b90b1ae4fbd425415ea8d02f44493a6c643b4b1a57f4507e87aa7ade3736

22 months agoMerge bitcoindevkit/bdk#1294: Expose `SpkIterator::new_with_range`
志宇 [Thu, 25 Jan 2024 11:56:25 +0000 (20:56 +0900)]
Merge bitcoindevkit/bdk#1294: Expose `SpkIterator::new_with_range`

8305e648494cbdd1f6438904ec367f8442fba606 feat(chain): expose `SpkIterator::new_with_range` (志宇)

Pull request description:

  ### Description

  This method is useful, I'm not sure why it is not public.

  I've also updated the docs and tests.

  ### Changelog notice

  Added
  * Expose `SpkIterator::new_with_range`

  ### Checklists

  #### All Submissions:

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

  #### New Features:

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

ACKs for top commit:
  danielabrozzoni:
    utACK 8305e648494cbdd1f6438904ec367f8442fba606
  LLFourn:
    ACK 8305e648494cbdd1f6438904ec367f8442fba606

Tree-SHA512: 26389bf65bea74742ebb4d170f3d21aeb02e5be1b3fd20ef16eb318393145809d2b21b96767ebb42acfd8dd789a82bb2d7b29ded24249dabf06bd1e6d23cf0cf

22 months agofix(file_store): recover file offset after read
志宇 [Tue, 23 Jan 2024 04:32:13 +0000 (12:32 +0800)]
fix(file_store): recover file offset after read

Because we use wrap the file with `BufReader` with the `EntryIter`, we
need to sync the `BufReader`'s position with the file's offset when we
drop the `EntryIter`. Therefore we have a custom drop impl for
`EntryIter`.

23 months agochain: set `DEFAULT_LOOKAHEAD` to 25
Yuki Kishimoto [Tue, 23 Jan 2024 08:44:38 +0000 (09:44 +0100)]
chain: set `DEFAULT_LOOKAHEAD` to 25

23 months agofeat(chain): expose `SpkIterator::new_with_range`
志宇 [Mon, 22 Jan 2024 06:21:20 +0000 (14:21 +0800)]
feat(chain): expose `SpkIterator::new_with_range`

Also update docs and add tests

23 months agorefactor(file_store): Use BufReader but simplify
LLFourn [Mon, 22 Jan 2024 02:48:48 +0000 (13:48 +1100)]
refactor(file_store): Use BufReader but simplify

23 months agoMerge bitcoindevkit/bdk#1253: Remove deprecated checksum routines
Daniela Brozzoni [Mon, 22 Jan 2024 21:24:25 +0000 (22:24 +0100)]
Merge bitcoindevkit/bdk#1253: Remove deprecated checksum routines

ed91a4bdb49276057eb7458e1a94653553be24e7 Consolidate `calc_checksum_bytes_internal` routine (Sebastian Falbesoner)
179cfeff51cefda80c16fa4558ba039143a2ad2c Remove deprecated `get_checksum{,_bytes}` routines (Sebastian Falbesoner)

Pull request description:

  ### Description

  This PR removes the routines `get_checksum` and `get_checksum_bytes` (in the bdk crate, descriptor/checksum.rs), which have been deprecated in 0.24.0. Consequently, the routine `calc_checksum_bytes_internal` is consolidated into `calc_checksum_bytes`, as the boolean parameter `exclude_hash` is not needed anymore. See also the two TODOs in the touched file.

  ### Notes to the reviewers

  In the second commit, the signature of the function `calc_checksum_bytes` slightly changes, as the `desc` parameter now is declared as `mut`, in order to change the local variable within the function. My rust experience is rather limited, so I'm not sure if this is a problem for users. IIUC, this is comparable to changing a pass-by-value parameter in C++ from `const std::string desc` to `std::string desc`, which is relevant only for the function implementation, but doesn't change the interface.

  ### Changelog notice

  - Remove deprecated `get_checksum` and `get_checksum_bytes` routines

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

Tree-SHA512: a29ead57d0369b67e7e79734d7ddc26f42e7ee78b3a6a336cbf9dfa5579f55e7ddbc20b1662d4bedddd7b40a49511dc21c2652911f56d84c9663099b383e1084

23 months agodoc(example_cli): add missing cli docs
vmammal [Wed, 17 Jan 2024 18:58:40 +0000 (13:58 -0500)]
doc(example_cli): add missing cli docs

23 months agoMerge bitcoindevkit/bdk#1277: fix(readme): update examples
Daniela Brozzoni [Mon, 22 Jan 2024 11:27:56 +0000 (12:27 +0100)]
Merge bitcoindevkit/bdk#1277: fix(readme): update examples

914db84824edf25418ab0b7b2df7bca84605d64d fix(readme): update examples (Jose Storopoli)

Pull request description:

  ### Description

  Some janitor cleaning in the README to update the `example-crates/`

  ### Notes to the reviewers

  None.

  ### Changelog notice

  - fix(readme): update example 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

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

Tree-SHA512: 9376e7ac816ebc4b0bd9652c2e357486e39c55f6542ef650087962b7a864655f7f70a6305b315363e3ed750ce4cea1a328b6a413c340aa94b693b130da2d36b5

23 months agoMerge bitcoindevkit/bdk#1289: doc(electrum_ext): fix docs for `RelevantTxids::into_co...
Daniela Brozzoni [Mon, 22 Jan 2024 11:19:25 +0000 (12:19 +0100)]
Merge bitcoindevkit/bdk#1289: doc(electrum_ext): fix docs for `RelevantTxids::into_confirmation_tim…

cf0c3337446b1de19ad6be9e68f5a9cb848d5773 doc(electrum_ext): fix docs for `RelevantTxids::into_confirmation_time_tx_graph` (vmammal)

Pull request description:

  Note also, the bit referring to Electrum's API sounds more like a developer note, so I made it a regular code comment.

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

Tree-SHA512: 0ebd6a753c8a0c573510a4d866068cb6e1c7e356c43b20b5179331a1b7d567e4dfbf7012c63ba9b7b9566bf6564a2d957d12e54d5c0232b7be9869dfe0958e85

23 months agofix(readme): update examples
Jose Storopoli [Mon, 15 Jan 2024 22:58:42 +0000 (19:58 -0300)]
fix(readme): update examples

23 months agoMerge bitcoindevkit/bdk#1291: doc(chain,esplora): minor documentation improvements
Daniela Brozzoni [Mon, 22 Jan 2024 11:01:27 +0000 (12:01 +0100)]
Merge bitcoindevkit/bdk#1291: doc(chain,esplora): minor documentation improvements

b6a58d4f9bab13be0f3518f556936fa77a6b7b39 doc(chain,esplora): minor documentation improvements (vmammal)

Pull request description:

  * Corrects an awkward use of the word 'an'
  * Adds missing backticks, brackets in a few places

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

Tree-SHA512: 42f12f218a9849b6fc1c8da28c4d41ca86fcc9ea52311d28f67fadbec030b6cb6986774d89a30e7a2b5ee569b08c7cfa2af71bbb9b06efacfa685dbe95820f73

23 months agoMerge bitcoindevkit/bdk#1288: doc(esplora): fix broken link in README
Daniela Brozzoni [Mon, 22 Jan 2024 10:53:25 +0000 (11:53 +0100)]
Merge bitcoindevkit/bdk#1288: doc(esplora): fix broken link in README

7c0f4653b281b4288e92ed8cd45ead8abd104f52 doc(esplora): fix broken link in README (vmammal)

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:
  danielabrozzoni:
    ACK 7c0f4653b281b4288e92ed8cd45ead8abd104f52

Tree-SHA512: 6e09a0b74c1a64bc9d0d0a067daf7766c4a46511c22b676251f61608d770d3ea2c1df81d4e9bbbee69720cad5cd2deb9b146cb7751277871f0cbf1be96efcc9f

23 months agoMerge bitcoindevkit/bdk#1285: doc(wallet): improve docs for `Wallet::sent_and_received`
志宇 [Fri, 19 Jan 2024 15:37:59 +0000 (23:37 +0800)]
Merge bitcoindevkit/bdk#1285: doc(wallet): improve docs for `Wallet::sent_and_received`

08b745ec9f16fa8ef18b0d9c92feb9d8ab87a184 doc(wallet): improve docs for `Wallet::sent_and_received` (vmammal)

Pull request description:

  Thank you @thunderbiscuit for raising this issue. I noticed this method borrows the language from `SpkTxOutIndex::sent_and_received`, which this PR doesn't touch. I think in general it's desirable that methods in `bdk_chain` crate would refer to some of the core structures directly.

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

Tree-SHA512: 7f1285c4baa5fb56fd65baa5585bd343338de9988b941618a2b9ab628d869563f6f71ce842f936e7e1fb6a56f2f1e50fc3deaff858e830b7039888e4e496ce9a

23 months agoMerge bitcoindevkit/bdk#1292: fix(store): Remove lifetime
志宇 [Fri, 19 Jan 2024 15:28:19 +0000 (23:28 +0800)]
Merge bitcoindevkit/bdk#1292: fix(store): Remove lifetime

e6433fb2c1526cff37e3a17cc71986759ebac30f feat(persist): Add stage_and_commit to Persist (LLFourn)
0bee46e75bc99112abc15de59984e6059ff874e5 fix(store): Remove lifetime (LLFourn)

Pull request description:

  Remove gratuitous use of lifetimes in the main persistence struct `Store`. Having lifetimes on this means that you have to keep the magic bytes alive longer than the database which is particularly offensive if you have to send the database to another thread. On top of that the bytes aren't even read.

ACKs for top commit:
  evanlinjin:
    ACK e6433fb2c1526cff37e3a17cc71986759ebac30f

Tree-SHA512: 7f6d9d60951a8ceaee30719d0771e15632c6fad0702294af15409c5df492669a07299874ef5ee34e3d75bdecbbd41df29bced3ff16b2360d5d5c7687ef677ffc

23 months agotest(esplora): introduce test cases for `update_local_chain`
志宇 [Thu, 11 Jan 2024 17:25:17 +0000 (01:25 +0800)]
test(esplora): introduce test cases for `update_local_chain`

23 months agofeat(esplora): greatly simplify `update_local_chain`
志宇 [Thu, 11 Jan 2024 13:23:52 +0000 (21:23 +0800)]
feat(esplora): greatly simplify `update_local_chain`

23 months agoMerge bitcoindevkit/bdk#1172: Introduce block-by-block API to `bdk::Wallet` and add...
志宇 [Fri, 19 Jan 2024 15:07:20 +0000 (23:07 +0800)]
Merge bitcoindevkit/bdk#1172: Introduce block-by-block API to `bdk::Wallet` and add RPC wallet example

a4f28c079e3bc4500e8329aeed230d8100d38617 chore: improve LocalChain::apply_header_connected_to doc (LLFourn)
8ec65f0b8ef7d452a0bdba6760c46bd8511c91ff feat(example): add RPC wallet example (Vladimir Fomene)
a7d01dc39acb3ff7f4bc8e237c7862d019a91cd1 feat(chain)!: make `IndexedTxGraph::apply_block_relevant` more efficient (志宇)
e0512acf9476fa3fa7da9cc28a222432f974aad5 feat(bitcoind_rpc)!: emissions include checkpoint and connected_to data (志宇)
8f2d4d9d400e398b54cf1bad36057f3f8f4a69a4 test(chain): `LocalChain` test for update that is shorter than original (志宇)
9467cad55d68354fe037d57bceeee57c2032bd51 feat(wallet): introduce block-by-block api (Vladimir Fomene)
d3e5095df10d21ff5cb7f8ce4dab7922f3cb6e35 feat(chain): add `apply_header..` methods to `LocalChain` (志宇)
2b61a122ff40253f2e67c0ae6824ce881c9f12a1 feat(chain): add `CheckPoint::from_block_ids` convenience method (志宇)

Pull request description:

  ### Description

  Introduce block-by-block API for `bdk::Wallet`. A `wallet_rpc` example is added to demonstrate syncing `bdk::Wallet` with the `bdk_bitcoind_rpc` chain-source crate.

  The API of `bdk_bitcoind_rpc::Emitter` is changed so the receiver knows how to connect to the block emitted.

  ### Notes to the reviewers

  ### Changelog notice

  Added
  * `Wallet` methods to apply full blocks (`apply_block` and `apply_block_connected_to`) and a method to apply a batch of unconfirmed transactions (`apply_unconfirmed_txs`).
  * `CheckPoint::from_block_ids` convenience method.
  * `LocalChain` methods to apply a block header (`apply_header` and `apply_header_connected_to`).
  * Test to show that `LocalChain` can apply updates that are shorter than original. This will happen during reorgs if we sync wallet with `bdk_bitcoind_rpc::Emitter`.

  Fixed
  * `InsertTxError` now implements `std::error::Error`.

  #### All Submissions:

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

  #### New Features:

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

ACKs for top commit:
  LLFourn:
    self-ACK: a4f28c079e3bc4500e8329aeed230d8100d38617
  evanlinjin:
    ACK a4f28c079e3bc4500e8329aeed230d8100d38617

Tree-SHA512: e39fb65b4e69c0a6748d64eab12913dc9cfe5eb8355ab8fb68f60a37c3bb2e1489ddd8f2f138c6470135344f40e3dc671928f65d303fd41fb63f577b30895b60

23 months agofeat(persist): Add stage_and_commit to Persist
LLFourn [Fri, 19 Jan 2024 00:23:46 +0000 (11:23 +1100)]
feat(persist): Add stage_and_commit to Persist

In the example_cli we were not always committing (seemingly by mistake).
This then caused all the examples to have to compensate by manually
committing.

23 months agofix(store): Remove lifetime
LLFourn [Thu, 18 Jan 2024 23:34:37 +0000 (10:34 +1100)]
fix(store): Remove lifetime

Remove gratuitous use of lifetimes in the main persistence struct

23 months agodoc(wallet): improve docs for `Wallet::sent_and_received`
vmammal [Wed, 17 Jan 2024 18:00:27 +0000 (13:00 -0500)]
doc(wallet): improve docs for `Wallet::sent_and_received`

23 months agoMerge bitcoindevkit/bdk#1282: Bump version to 1.0.0-alpha.4 v1.0.0-alpha.4
志宇 [Thu, 18 Jan 2024 11:22:41 +0000 (19:22 +0800)]
Merge bitcoindevkit/bdk#1282: Bump version to 1.0.0-alpha.4

d33acc14661326972b3ab3cf2b7cee4ca078f4da Bump version to 1.0.0-alpha.4 (Steve Myers)

Pull request description:

  ### Description

  Bump version to 1.0.0-alpha.4, also:

  bdk_chain to 0.8.0
  bdk_bitcoind_rpc to 0.3.0
  bdk_electrum to 0.6.0
  bdk_esplora to 0.6.0
  bdk_file_store to 0.4.0

  Fixes #1281.

  ### Notes to the reviewers

  Since the version of bdk_chain changed all crates that depend on it also need to have their versions bumped.

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

Tree-SHA512: ffb5c05b45e9d646ef796bd894353e4b58c3aae3dcf0921dfb9fcae45020ed4fc82274a7497494d6259bfffff9c2f97c530d2cbe6ace578babd04852af461f3a

23 months agoBump version to 1.0.0-alpha.4
Steve Myers [Tue, 16 Jan 2024 17:28:41 +0000 (11:28 -0600)]
Bump version to 1.0.0-alpha.4

bdk_chain to 0.8.0
bdk_bitcoind_rpc to 0.3.0
bdk_electrum to 0.6.0
bdk_esplora to 0.6.0
bdk_file_store to 0.4.0

23 months agoMerge bitcoindevkit/bdk#1286: doc, example(bdk): fix derivation path in mnemonic_to_d...
Daniela Brozzoni [Thu, 18 Jan 2024 11:05:25 +0000 (12:05 +0100)]
Merge bitcoindevkit/bdk#1286: doc, example(bdk): fix derivation path in mnemonic_to_descriptors

d494f63d08f60ce01c22ff08f7e88a80a7be2522 doc, example(bdk): fix derivation path in mnemonic_to_descriptors (vmammal)

Pull request description:

  This will help avoid confusion with mainnet descriptors.

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

Tree-SHA512: f0450d171bc53085204280495f2954e20f4b64a73cfbcc9a0c3be131c0b04ad53e936c83fa83c89fbd1ed1c4edd680e8437550453f75056049d36f84cae1df43

23 months agoMerge bitcoindevkit/bdk#1269: Revamp `KeychainTxOutIndex` API to be safer
Daniela Brozzoni [Thu, 18 Jan 2024 10:24:31 +0000 (11:24 +0100)]
Merge bitcoindevkit/bdk#1269: Revamp `KeychainTxOutIndex` API to be safer

71fff1613d1c167d180636857063e181f6acedf1 feat(chain): add txout methods to `KeychainTxOutIndex` (志宇)
83e7b7ec402bef27c3f83876f346ec2abd23eff1 docs(chain): improve `KeychainTxOutIndex` docs (志宇)
9294e30943f3f79bb36915d69652d9086323131f docs(wallet): improve docs for unbounded spk iterator methods (志宇)
b74c2e262255a39e9dc904aad469e307bf7d0151 fix(wallet): use efficient peek address logic (志宇)
81aeaba48a980a7e7add76ac2d24e896bedaa1d2 feat(chain): add `SpkIterator::descriptor` method (志宇)
c7b47af72f278ba73abea58db49cff1245428f97 refactor(chain)!: revamp `KeychainTxOutIndex` API (志宇)
705690ee8fddba8517d907183b7ddfeafb633609 feat(chain): make output of `SpkTxOutIndex::unused_spks` cloneable (志宇)

Pull request description:

  Closes #1268

  ### Description

  Previously `SpkTxOutIndex` methods can be called from `KeychainTxOutIndex` due to the `DeRef` implementation. However, the internal `SpkTxOut` will also contain lookahead spks resulting in an error-prone API.

  `SpkTxOutIndex` methods are now not directly callable from `KeychainTxOutIndex`. Methods of `KeychainTxOutIndex` are renamed for clarity. I.e. methods that return an unbounded spk iter are prefixed with `unbounded`.

  In addition to this, I also optimized the peek-address logic of `bdk::Wallet` using the optimized `<SpkIterator as Iterator>::nth` implementation.

  ### Notes to the reviewers

  This is mostly refactoring, but can also be considered a bug-fix (as the API before was very problematic).

  ### Changelog notice

  Changed
  * Wallet's peek-address logic is optimized by making use of `<SpkIterator as Iterator>::nth`.
  * `KeychainTxOutIndex` API is refactored to better differentiate between methods that return unbounded vs stored spks.
  * `KeychainTxOutIndex` no longer directly exposes `SpkTxOutIndex` methods via `DeRef`. This was problematic because `SpkTxOutIndex` also contains lookahead spks which we want to hide.

  Added
  * `SpkIterator::descriptor` method which gets a reference to the internal descriptor.

  ### Checklists

  #### All Submissions:

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

  #### New Features:

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

  #### Bugfixes:

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

ACKs for top commit:
  danielabrozzoni:
    ACK 71fff1613d1c167d180636857063e181f6acedf1

Tree-SHA512: f29c7d2311d0e81c4fe29b8f57c219c24db958194fad5de82bb6d42d562d37fd5d152be7ee03a3f00843be5760569ad29b848250267a548d7d15320fd5292a8f

23 months agofeat(chain): add txout methods to `KeychainTxOutIndex`
志宇 [Thu, 18 Jan 2024 06:30:29 +0000 (14:30 +0800)]
feat(chain): add txout methods to `KeychainTxOutIndex`

`txouts` and `txouts_in_tx` are exposed from `SpkTxOutIndex`, but
modified to remove nested unions.

Add `keychain_outpoints_in_range` that iterates over outpoints of a
given keychain derivation range.

23 months agodoc(chain,esplora): minor documentation improvements
vmammal [Wed, 17 Jan 2024 19:07:14 +0000 (14:07 -0500)]
doc(chain,esplora): minor documentation improvements

* Corrects an awkward use of the word 'an'
* Adds missing backticks, brackets in a few places

23 months agodoc(electrum_ext): fix docs for `RelevantTxids::into_confirmation_time_tx_graph`
vmammal [Wed, 17 Jan 2024 18:49:58 +0000 (13:49 -0500)]
doc(electrum_ext): fix docs for `RelevantTxids::into_confirmation_time_tx_graph`

23 months agodoc(esplora): fix broken link in README
vmammal [Wed, 17 Jan 2024 18:45:35 +0000 (13:45 -0500)]
doc(esplora): fix broken link in README

23 months agodoc(store): update doc for `Store::aggregate_changesets`
vmammal [Wed, 17 Jan 2024 18:41:23 +0000 (13:41 -0500)]
doc(store): update doc for `Store::aggregate_changesets`

23 months agodoc, example(bdk): fix derivation path in mnemonic_to_descriptors
vmammal [Wed, 17 Jan 2024 18:29:25 +0000 (13:29 -0500)]
doc, example(bdk): fix derivation path in mnemonic_to_descriptors

This will help avoid confusion with mainnet descriptors.

23 months agodocs(chain): improve `KeychainTxOutIndex` docs
志宇 [Wed, 17 Jan 2024 05:30:28 +0000 (13:30 +0800)]
docs(chain): improve `KeychainTxOutIndex` docs

More clarity for revealed/lookahead spks and give usecases.

23 months agodocs(wallet): improve docs for unbounded spk iterator methods
志宇 [Wed, 17 Jan 2024 05:29:16 +0000 (13:29 +0800)]
docs(wallet): improve docs for unbounded spk iterator methods

23 months agofix(wallet): use efficient peek address logic
志宇 [Sat, 13 Jan 2024 12:38:11 +0000 (20:38 +0800)]
fix(wallet): use efficient peek address logic

Changes the peek address logic to use the optimized `Iterator::nth`
implementation of `SpkIterator`.

Additionally, docs are added for panics that will occur when the caller
requests for addresses with out-of-bound derivation indices (BIP32).

23 months agofeat(chain): add `SpkIterator::descriptor` method
志宇 [Sat, 13 Jan 2024 10:33:01 +0000 (18:33 +0800)]
feat(chain): add `SpkIterator::descriptor` method

Otherwise there will be no way to view the descriptor of the
`SpkIterator`.

23 months agorefactor(chain)!: revamp `KeychainTxOutIndex` API
志宇 [Sat, 13 Jan 2024 12:04:49 +0000 (20:04 +0800)]
refactor(chain)!: revamp `KeychainTxOutIndex` API

Previously `SpkTxOutIndex` methods can be called from
`KeychainTxOutIndex` due to the `DeRef` implementation. However, the
internal `SpkTxOut` will also contain lookahead spks resulting in an
error-prone API.

`SpkTxOutIndex` methods are now not directly callable from
`KeychainTxOutIndex`. Methods of `KeychainTxOutIndex` are renamed for
clarity. I.e. methods that return an unbounded spk iter are prefixed
with `unbounded`.

23 months agotest(wallet): fix tests helpers to generate unique utxos
志宇 [Tue, 16 Jan 2024 14:33:42 +0000 (22:33 +0800)]
test(wallet): fix tests helpers to generate unique utxos