1967 Commits

Author SHA1 Message Date
Steve Myers
782eb56bd4
Merge bitcoindevkit/bdk#1454: Refactor wallet and persist mod, remove bdk_persist crate
ec36c7eccacc8347568b77ed1dfc0c50a2524906 feat(example): use changeset staging with rpc polling example (志宇)
19328d4999c19557778b7b108f88f42b1258957e feat(wallet)!: change persist API to use `StageExt` and `StageExtAsync` (志宇)
2e40b0118cc88539f38420e347eb4d562b1be0b1 feat(chain): reintroduce a way to stage changesets before persisting (志宇)
36e82ec6869c5c5c5669d4d049636225f9a8e986 chore(chain): relax `miniscript` feature flag scope (志宇)
9e97ac03307f3194e043ef430e4bde2e5c25254c refactor(persist): update file_store, sqlite, wallet to use bdk_chain::persist (Steve Myers)
54b0c11cbe1d08eb955e50f0ac719a0b19e3032a feat(persist): add PersistAsync trait and StagedPersistAsync struct (Steve Myers)
aa640ab2770bea19259eedea6882b202a5845f35 refactor(persist): rename PersistBackend to Persist, move to chain crate (Steve Myers)

Pull request description:

  ### Description

  Sorry to submit another refactor PR for the persist related stuff, but I think it's worth revisiting. My primary motivations are:

  1. remove `db` from `Wallet` so users have the ability to use `async` storage crates, for example using `sqlx`. I updated docs and examples to let users know they are responsible for persisting changes.
  2. remove the `anyhow` dependency everywhere (except as a dev test dependency). It really doesn't belong in a lib and by removing persistence from `Wallet` it isn't needed.
  3. remove the `bdk_persist` crate and revert back to the original design with generic error types. I kept the `Debug` and `Display` constrains on persist errors so they could still be used with the `anyhow!` macro.

  ### Notes to the reviewers

  I also replaced/renamed old `Persist` with `StagedPersist` struct inspired by #1453, it is only used in examples. The `Wallet` handles it's own staging.

  ### Changelog notice

  Changed

  - Removed `db` from `Wallet`, users are now responsible for persisting changes, see docs and examples.
  - Removed the `bdk_persist` crate and moved logic back to `bdk_chain::persist` module.
  - Renamed `PersistBackend` trait to `Persist`
  - Replaced `Persist` struct with `StagedPersist`

  ### Checklists

  #### All Submissions:

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

ACKs for top commit:
  ValuedMammal:
    ACK ec36c7eccacc8347568b77ed1dfc0c50a2524906

Tree-SHA512: 380b94ae42411ea174720b7c185493c640425f551742f25576a6259a51c1037b441a238c6043f4fdfbf1490aa15f948a34139f1850d0c18d285110f6a9f36018
2024-06-13 17:52:54 -05:00
志宇
ec36c7ecca
feat(example): use changeset staging with rpc polling example 2024-06-13 12:58:39 -05:00
志宇
19328d4999
feat(wallet)!: change persist API to use StageExt and StageExtAsync 2024-06-13 12:58:35 -05:00
志宇
2e40b0118c
feat(chain): reintroduce a way to stage changesets before persisting
A staging area is helpful because we can contain logic to ignore empty
changesets and not clear staging area if the persistence backend fails.
2024-06-13 12:56:31 -05:00
志宇
36e82ec686
chore(chain): relax miniscript feature flag scope
Still enable the `persist` submodule without `miniscript` feature flag.
Only disable `CombinedChangeSet`.

Also stop `cargo clippy` from complaining about unused imports when
`miniscript` is disabled.
2024-06-13 12:56:30 -05:00
Steve Myers
9e97ac0330
refactor(persist): update file_store, sqlite, wallet to use bdk_chain::persist
Also update examples and remove bdk_persist crate.
2024-06-13 12:56:25 -05:00
Steve Myers
54b0c11cbe
feat(persist): add PersistAsync trait and StagedPersistAsync struct 2024-06-13 12:40:50 -05:00
Steve Myers
aa640ab277
refactor(persist): rename PersistBackend to Persist, move to chain crate
Also add refactored StagedPersist to chain crate with tests.
2024-06-13 12:40:49 -05:00
志宇
1c593a34ee
Merge bitcoindevkit/bdk#1463: No descriptor ids in spk txout index
8dd174479f9719309663ed979a5b4b86aca0a6e9 refactor(chain): compute txid once for `KeychainTxOutIndex::index_tx` (志宇)
639d735ca0ae54d8b2c3bc28241032154b94d45e refactor(chain): change field names to be more sane (志宇)
5a02f40122f1bfa06c80bac93f68f5799225d133 docs(chain): fix docs (志宇)
c77e12bae7f465ec7fb08b8be16d99793c757cf0 refactor(chain): `KeychainTxOutIndex` use `HashMap` for fields (志宇)
4d3846abf4f59b4a97bb825281655a6b67275603 chore(chain): s/replenish_lookahead/replenish_inner_index/ (LLFourn)
8779afdb0bf4e9b1004f47f86a770d25938d206d chore(chain): document insert_descriptor invariants better (LLFourn)
69f2a695f7dc25478489080598fea0813ea7d93d refactor(chain): improve replenish lookeahd internals (LLFourn)
5a584d0fd8c138757a10c7af93ec9e09523317e1 chore(chain): Fix Indexed and KeychainIndexed documentaion (Lloyd Fournier)
b8ba5a02066fad7ab2ce276ba071385cd1dbbe3a chore(chain): Improve documentation of keychain::ChangeSet (LLFourn)
101a09a97fa5e8d675c13396b9a800665b1b6c22 chore(chain): Standardise KeychainTxOutIndex return types (LLFourn)
bce070b1d662db7ac120e1d236fdda51842ad738 chore(chain): add type IndexSpk, fix clippy type complexity warning (Steve Myers)
4d2442c37f5c1bd822795271a79676d1ffbe7916 chore(chain): misc docs and insert_descriptor fixes (LLFourn)
bc2a8be97919f0d09b61438527bda24796bcec94 refactor(keychain): Fix KeychainTxOutIndex range queries (LLFourn)
3b2ff0cc953204c9925ace8e2f0bbef409c63ad5 Write failing test for keychain range querying (LLFourn)

Pull request description:

  Fixes #1459

  This reverts part of the changes in #1203. There the `SpkTxOutIndex<(K,u32)>` was changed to `SpkTxOutIndex<(DescriptorId, u32>)`. This led to a complicated translation logic in  `KeychainTxOutIndex` (where the API is based on `K`) to transform calls to it to calls to the underlying `SpkTxOutIndex` (which now indexes by `DescriptorId`). The translation layer was broken when it came to translating range queries from the `KeychainTxOutIndex`. My solution was just to revert this part of the change and remove the need for a translation layer (almost) altogether. A thin translation layer remains to ensure that un-revealed spks are filtered out before being returned from the `KeychainTxOutIndex` methods.

  I feel like this PR could be extended to include a bunch of ergonomics improvements that are easier to implement now. But I think that's the point of https://github.com/bitcoindevkit/bdk/pull/1451 so I held off and should probably go and scope creep that one instead.

  ### 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
  * [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 8dd174479f9719309663ed979a5b4b86aca0a6e9

Tree-SHA512: 283e6b6d4218902298e2e848fe847a6c85e27af4eee3e4337e3dad6eacf9beaa08ac99b1dce7b6fb199ca53931e543ea365728a81c41567a2e510cce77b12ac0
2024-06-13 23:11:02 +08:00
志宇
8dd174479f
refactor(chain): compute txid once for KeychainTxOutIndex::index_tx 2024-06-13 23:03:34 +08:00
志宇
639d735ca0
refactor(chain): change field names to be more sane 2024-06-13 22:52:47 +08:00
志宇
5a02f40122
docs(chain): fix docs 2024-06-13 22:52:47 +08:00
志宇
c77e12bae7
refactor(chain): KeychainTxOutIndex use HashMap for fields
Instead of `BTreeMap` which is less performant.
2024-06-13 22:52:47 +08:00
LLFourn
4d3846abf4
chore(chain): s/replenish_lookahead/replenish_inner_index/ 2024-06-13 22:52:46 +08:00
LLFourn
8779afdb0b
chore(chain): document insert_descriptor invariants better 2024-06-13 22:52:46 +08:00
LLFourn
69f2a695f7
refactor(chain): improve replenish lookeahd internals
see: 4eb1e288a9 (r1630943639)
2024-06-13 22:52:45 +08:00
Lloyd Fournier
5a584d0fd8
chore(chain): Fix Indexed and KeychainIndexed documentaion
Co-authored-by: ValuedMammal <valuedmammal@protonmail.com>
2024-06-13 22:52:45 +08:00
LLFourn
b8ba5a0206
chore(chain): Improve documentation of keychain::ChangeSet 2024-06-13 22:52:45 +08:00
LLFourn
101a09a97f
chore(chain): Standardise KeychainTxOutIndex return types
The previous commit b9c5b9d08b040faf6c6b2d9b3745918031555b72 added
IndexSpk. This goes further and adds `Indexed` and `KeychainIndexed`
type alises (IndexSpk is Indexed<ScriptBuf>) and attempts to standardize
the structure of return types more generally.
2024-06-13 22:52:44 +08:00
Steve Myers
bce070b1d6
chore(chain): add type IndexSpk, fix clippy type complexity warning 2024-06-13 22:52:44 +08:00
LLFourn
4d2442c37f
chore(chain): misc docs and insert_descriptor fixes 2024-06-13 22:52:43 +08:00
LLFourn
bc2a8be979
refactor(keychain): Fix KeychainTxOutIndex range queries
The underlying SpkTxOutIndex should not use DescriptorIds to index
because this loses the ordering relationship of the spks so queries on
subranges of keychains work.

Along with that we enforce that there is a strict 1-to-1 relationship
between descriptors and keychains. Violating this leads to an error in
insert_descriptor now.

In general I try to make the translation layer between the SpkTxOutIndex
and the KeychainTxOutIndex thinner. Ergonomics of this will be improved
in next commit.

The test from the previous commit passes.
2024-06-13 22:52:43 +08:00
LLFourn
3b2ff0cc95
Write failing test for keychain range querying 2024-06-13 22:52:42 +08:00
Steve Myers
3b040a7ee6
Merge bitcoindevkit/bdk#1448: bump(deps): upgrade rust bitcoin to 0.32.0, miniscript to 0.12.0 and others
11200810d048abb8deb3c7961ca93c68011d41fd chore(wallet): rm dup code (志宇)
2a4564097bd70905ed9fa21b92cdf074a72f878e deps(bdk): bump `bitcoin` to `0.32.0`, miniscript to `12.0.0` (Leonardo Lima)

Pull request description:

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

  ### Description

  This PR focuses on upgrading the `rust-bitcoin` and `miniscript` versions, to `0.32.0` and `0.12.0`, respectively. It also bumps the versions of other BDK ecosystem crates that also rely on both `rust-bitcoin` and `miniscript`, being:

  - electrum-client https://github.com/bitcoindevkit/rust-electrum-client/pull/133
  - esplora-client https://github.com/bitcoindevkit/rust-esplora-client/pull/85
  - hwi https://github.com/bitcoindevkit/rust-hwi/pull/99

  <ins>I structured the PR in multiple commits, with closed scope, being one for each BDK crate being upgraded, and one for each kind of fix and upgrade required, it seems like a lot of commits (**that should be squashed before merging**), but I think it'll make it easier during review phase.</ins>

  In summary I can already mention some of the main changes:
  - using `compute_txid()` instead of deprecated `txid()`
  - using `minimal_non_dust()` instead of `dust_value()`
  - using the renamed `signature` and `sighash_type` fields
  - using proper `sighash::P2wpkhError`,  `sighash::TaprootError` instead of older `sighash::Error`
  - conversion from `Network` to new expected `NetworkKind` #1465
  - conversion from the new `Weight` type to current expected `usize` #1466
  - using `.into()` to convert from AbsLockTime and `RelLockTime` to `absolute::LockTime` and `relative::LockTime`
  - using Message::from_digest() instead of relying on deprecated `ThirtyTwoByteHash` trait.
  - updating the miniscript policy and dsl to proper expect and handle new `Threshold` type, instead of the previous two parameters.

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

  ### Notes to the reviewers
  <ins>Again, I structured the PR in multiple commits, with closed scope, being one for each BDK crate being upgraded, and one for each kind of fix and upgrade required, it seems like a lot of commits (**that should be squashed before merging**), but I think it'll make it easier during review phase.</ins>

  It should definitely be carefully reviewed, especially the last commits for the wallet crate scope, the ones with the semantic `fix(wallet)`.

  I would also appreciate if @tcharding reviewed it, as he gave a try in the past (#1400 ), and I relied on some of it for the  policy part of it, other rust-bitcoin maintainers reviews are a definitely welcome 😁

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

  ### Changelog notice
  > // TODO(@oleonardolima): Do another pass and double check the changes
  - Use `compute_txid()` instead of deprecated `txid()`
  - Use `minimal_non_dust()` instead of `dust_value()`
  - Use `signature` and `sighash_type` fields, instead of previous `sig` and `hash_type`
  - Use `sighash::P2wpkhError`,  and `sighash::TaprootError` instead of older `sighash::Error`
  - Converts from `Network` to `NetworkKind`, where expected
  - Converts from `Weight` type to current used `usize`
  - Use `.into()` to convert from `AbsLockTime` and `RelLockTime` to `absolute::LockTime` and `relative::LockTime`
  - Remove use of  deprecated `ThirtyTwoByteHash` trait, use `Message::from_digest()`
  - Update the miniscript policy and dsl macros to proper expect and handle new `Threshold` type, instead of the previous two parameters.

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

  ### Checklists

  #### All Submissions:

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

  #### New Features:

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

  #### Bugfixes:

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

ACKs for top commit:
  notmandatory:
    ACK 11200810d048abb8deb3c7961ca93c68011d41fd

Tree-SHA512: ba1ab64603b41014d3f0866d846167f77d31959ca6f1d9c3181d5e543964f5d772e05651d63935ba7bbffeba41a66868d27de4c32129739b9ca50f3bbaf9f2a1
2024-06-12 23:12:28 -05:00
志宇
11200810d0
chore(wallet): rm dup code
Methods `make_multi` and `make_multi_a` were essentially the same thing
except for a different const generic param on `Threshold`. So we rm
`make_multi_a` and put a const generic param on `make_multi`.
2024-06-13 11:47:01 +08:00
Leonardo Lima
2a4564097b
deps(bdk): bump bitcoin to 0.32.0, miniscript to 12.0.0
deps(chain): bump `bitcoin` to `0.32.0`, miniscript to `12.0.0`

fix(chain): use `minimal_non_dust()` instead of `dust_value()`

fix(chain): use `compute_txid()` instead of `txid`

deps(testenv): bump `electrsd` to `0.28.0`

deps(electrum): bump `electrum-client` to `0.20.0`

fix(electrum): use `compute_txid()` instead of `txid`

deps(esplora): bump `esplora-client` to `0.8.0`

deps(bitcoind_rpc): bump `bitcoin` to `0.32.0`, `bitcoincore-rpc` to
`0.19.0`

fix(bitcoind_rpc): use `compute_txid()` instead of `txid`

fix(nursery/tmp_plan): use proper `sighash` errors, and fix the expected
`Signature` fields

fix(sqlite): use `compute_txid()` instead of `txid`

deps(hwi): bump `hwi` to `0.9.0`

deps(wallet): bump `bitcoin` to `0.32.0`, miniscript to `12.0.0`

fix(wallet): use `compute_txid()` and `minimal_non_dust()`

- update to use `compute_txid()` instead of deprecated `txid()`
- update to use `minimal_non_dust()` instead of `dust_value()`
- remove unused `bitcoin::hex::FromHex`.

fix(wallet): uses `.into` conversion on `Network` for `NetworkKind`

- uses `.into()` when appropriate, otherwise use the explicit
  `NetworkKind`, and it's `.is_mainnet()` method.

fix(wallet): add P2wpkh, Taproot, InputsIndex errors to `SignerError`

fix(wallet): fields on taproot, and ecdsa `Signature` structure

fix(wallet/wallet): convert `Weight` to `usize` for now

- converts the `bitcoin-units::Weight` type to `usize` with help of
  `to_wu()` method.
- it should be updated/refactored in the future to handle the `Weight`
  type throughout the code instead of current `usize`, only converting
  it for now.
- allows the usage of deprecated `is_provably_unspendable()`, needs
  further discussion if suggested `is_op_return` is suitable.
- update the expect field to `signature`, as it was renamed from `sig`.

fix(wallet/wallet): use `is_op_return` instead of
`is_provably_unspendable`

fix(wallet/wallet): use `relative::Locktime` instead of `Sequence`

fix(wallet/descriptor): use `ParsePublicKeyError`

fix(wallet/descriptor): use `.into()` to convert from `AbsLockTime` and
`RelLockTime` to `absolute::LockTime` and `relative::LockTime`

fix(wallet/wallet): use `Message::from_digest()` instead of relying on
deprecated `ThirtyTwoByteHash` trait.

fix(wallet/descriptor+wallet): expect `Threshold` type, and handle it
internally

fix(wallet/wallet): remove `0x` prefix from expected `TxId` display

fix(examples): use `compute_txid()` instead of `txid`

fix(ci): remove usage of `bitcoin/no-std` feature

- remove comment: `# The `no-std` feature it's implied when the `std` feature is disabled.`
2024-06-12 10:31:50 -03:00
Lloyd Fournier
473ef9714f
Merge pull request #1470 from notmandatory/ci/pin_url_dep
ci: pin url dependency version to build with rust 1.63
2024-06-12 10:36:54 +10:00
Steve Myers
25b914ba0a
ci: pin url dependency version to build with rust 1.63 2024-06-11 18:43:07 -05:00
志宇
b4a847f801
Merge bitcoindevkit/bdk#1441: Remove duplicated InsufficientFunds error member
29c8a00b435bdf2fa1d7c707ad09c1a47edc07b3 chore(wallet): remove duplicated InsufficientFunds error member from CreateTxError (e1a0a0ea)

Pull request description:

  closes #1440

  ### Description

  - Replace `CreateTxError::InsufficientFunds` use by `coin_selection::Error::InsufficientFunds`
  - Remove `InsufficientFunds` member from `CreateTxError` enum
  - Rename `coin_selection::Error` to `coin_selection::CoinSelectionError`

  ### Notes to the reviewers

  - We could also keep both members but rename one of them to avoid confusion

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

Tree-SHA512: a1132d09929f99f0a5e82d3ccfaa85695ae50d7d4d5d9e8fd9ef847313918ed8c7a01005f45483fef6aeae36730a0da2fed9a9f10c3ce2f0a679527caf798bfe
2024-06-06 12:17:46 +08:00
Steve Myers
c5a3b62d63
Merge bitcoindevkit/bdk#1390: Make Wallet require a change descriptor
8bc3d35f6c83d078551c4bc57f72f13324865486 fix(wallet): `LoadError::MissingDescriptor` includes the missing KeychainKind (valued mammal)
412dee1f5b027af7800ee155717d47f4ab4b60e0 ref(wallet)!: Make `Wallet::public_descriptor` infallible (valued mammal)
c2513e1090374d7871a8623845bd10757e6ab0b3 test(wallet): Clarify docs for get_funded_wallet (valued mammal)
9d954cf7d25d43c77115cd931407005a09365389 refactor(wallet)!: Make Wallet require a change descriptor (valued mammal)

Pull request description:

  All `Wallet` constructors are modified to require a change descriptor, where previously it was optional. Additionally we enforce uniqueness of the change descriptor to avoid ambiguity when deriving scripts and ensure the wallet will always have two distinct keystores.

  Notable changes

  * Add error `DescriptorError::ExternalAndInternalAreTheSame`
  * Remove error `CreateTxError::ChangePolicyDescriptor`
  * No longer rely on `map_keychain`

  fixes #1383

  ### Notes to the reviewers

  ### Changelog notice

  Changed:

  Constructing a Wallet now requires two distinct 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:
  notmandatory:
    re-ACK 8bc3d35f6c83d078551c4bc57f72f13324865486

Tree-SHA512: f0621deb75d8e1e484b18b40d850f64e26314e39c4778f56c627763ddbffd376288bf6f0f37b61ba2ba744c7083683497d2dfef42bc4ef7d3ed7b374a54d813a
2024-06-05 23:11:00 -05:00
e1a0a0ea
29c8a00b43
chore(wallet): remove duplicated InsufficientFunds error member from CreateTxError
review: move back to old error naming
2024-06-06 11:08:23 +08:00
valued mammal
8bc3d35f6c
fix(wallet): LoadError::MissingDescriptor includes the missing KeychainKind 2024-06-05 06:29:58 -04:00
valued mammal
412dee1f5b
ref(wallet)!: Make Wallet::public_descriptor infallible 2024-06-05 06:29:58 -04:00
valued mammal
c2513e1090
test(wallet): Clarify docs for get_funded_wallet 2024-06-05 06:29:58 -04:00
valued mammal
9d954cf7d2
refactor(wallet)!: Make Wallet require a change descriptor
All `Wallet` constructors are modified to require a change
descriptor, where previously it was optional. Additionally
we enforce uniqueness of the change descriptor to avoid
ambiguity when deriving scripts and ensure the wallet will
always have two distinct keystores.

Notable changes

* Add error DescriptorError::ExternalAndInternalAreTheSame
* Remove error CreateTxError::ChangePolicyDescriptor
* No longer rely on `map_keychain`
2024-06-05 06:29:52 -04:00
志宇
8eef350bd0
Merge bitcoindevkit/bdk#1453: refactor(electrum) put the tx cache in electrum
2d2656acfa83ab4c4846c0aab14072efb64c5cc3 feat(electrum): re-export `transaction_broadcast` method (志宇)
53fa35096fbeea2b82b28987e8ef6f7d39ffc80b refactor(electrum)!: put the tx cache in electrum (LLFourn)

Pull request description:

  Previously there was a `TxCache` that you passed in as part of the sync request. There are lots of downsides to this:

  1. If the user forgets to do this you cache nothing
  2. where are you meant to keep this cache? The example shows it being recreated every time which seems very suboptimal.
  3. More API and documentation surface area.

  Instead just do a plain old simple cache inside the electrum client. This way at least you only download transactions once. You can pre-populate the cache with a method also and I did this in the examples.

  * [x] This pull request breaks the existing API

ACKs for top commit:
  evanlinjin:
    self-ACK 2d2656acfa83ab4c4846c0aab14072efb64c5cc3
  notmandatory:
    ACK 2d2656acfa83ab4c4846c0aab14072efb64c5cc3

Tree-SHA512: 6c29fd4f99ea5bd66234d5cdaf4b157a192ddd3baacc91076e402d8df0de7010bc482e24895e85fcb2f805ec6d1ce6cdb7654f8f552c90ba75ed35f80a00b856
2024-06-05 10:19:00 +08:00
Leonardo Lima
20341a3ca1
fix: typo on SignedAmount instead of Amount 2024-06-04 21:53:08 -03:00
Steve Myers
363d9f42e5
Merge bitcoindevkit/bdk#1455: refactor(wallet): rename get_balance() to balance()
50137b0425fe9c9aac8caaacf099bfe6c69859c2 refactor(wallet): rename get_balance() to balance() (Steve Myers)

Pull request description:

  ### Description

  fixes #1221

  ### Notes to the reviewers

  See discussion in #1221.

  ### Changelog notice

  Changed

  - Wallet::get_balance() renamed to Wallet::balance()

  ### Checklists

  #### All Submissions:

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

ACKs for top commit:
  LagginTimes:
    ACK 50137b0425fe9c9aac8caaacf099bfe6c69859c2
  oleonardolima:
    ACK 50137b0425fe9c9aac8caaacf099bfe6c69859c2
  evanlinjin:
    ACK 50137b0425fe9c9aac8caaacf099bfe6c69859c2

Tree-SHA512: 20d188a32c79eca37b4f269e5bcdb8c2ecd595911558cb74812a37da13a4f39b603deed3bc11356aa6523b16417a2a025046b3dd4df5bd7247f39c29d7f48ac2
2024-06-04 17:12:37 -05:00
Steve Myers
26586fa7fe
Merge bitcoindevkit/bdk#1426: feat: add further bitcoin::Amount usage on public APIs
a03949adb0c38ba4c2f44b497871070c1a2170d2 feat: use `Amount` on `calculate_fee`, `fee_absolute`, `fee_amount` and others (Leonardo Lima)

Pull request description:

  builds on top of #1411, further improves #823

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

  ### Description

  It further updates and adds the usage of `bitcoin::Amount` instead of `u64`.

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

  ### Notes to the reviewers

  Open for comments and discussions.

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

  ### Changelog notice
  - Updated `CreateTxError::FeeTooLow` to use `bitcoin::Amount`.
  - Updated `Wallet::calculate_fee()`. to use `bitcoin::Amount`
  - Updated `TxBuilder::fee_absolute()`. to use `bitcoin::Amount`.
  - Updated `CalculateFeeError::NegativeFee` to use `bitcoin::SignedAmount`.
  - Updated `TxGraph::calculate_fee()`. to use `bitcoin::Amount`.
  - Updated `PsbUtils::fee_amount()` to use `bitcoin::Amount`.

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

  ### Checklists

  #### All Submissions:

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

  #### New Features:

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

ACKs for top commit:
  storopoli:
    ACK a03949adb0c38ba4c2f44b497871070c1a2170d2

Tree-SHA512: abfbf7d48ec004eb448ed0a928e7e64b5f82a2ab51ec278fede4ddbff4eaba16469a7403f78dfeba1aba693b0132a528bc7c4ef072983cbbcc2592993230e40f
2024-06-04 16:16:03 -05:00
志宇
2d2656acfa
feat(electrum): re-export transaction_broadcast method
Also: update `wallet_electrum` example to use the method.
2024-06-04 12:24:41 +08:00
LLFourn
53fa35096f
refactor(electrum)!: put the tx cache in electrum
Previously there was a tx cache that you passed in as part of the sync
request. This seems bad and the example show'd that you should copy all
your transactions from the transaction graph into the sync request every
time you sync'd. If you forgot to do this then you would always download everything.

Instead just do a plain old simple cache inside the electrum client.
This way at least you only download transactions once. You can
pre-populate the cache with a method also and I did this in the examples.
2024-06-04 12:23:01 +08:00
Leonardo Lima
a03949adb0
feat: use Amount on calculate_fee, fee_absolute, fee_amount and others
- update to use `bitcoin::Amount` on `CreateTxError::FeeTooLow` variant.
- update to use `bitcoin::Amount` on `Wallet::calculate_fee()`.
- update to use `bitcoin::Amount` on `FeePolicy::fee_absolute()`.
- update to use `bitcoin::SignedAmount` on
  `CalculateFeeError::NegativeFee` variant.
- update to use `bitcoin::Amount` on `TxGraph::calculate_fee()`.
- update to use `bitcoin::Amount` on `PsbUtils::fee_amount()`
2024-06-03 13:19:16 -03:00
Steve Myers
50137b0425
refactor(wallet): rename get_balance() to balance() 2024-06-01 17:46:24 -05:00
Steve Myers
4a8452f9b8
Merge bitcoindevkit/bdk#1450: Bump bdk version to 1.0.0-alpha.12
108061dddbba99f03d7416a673135211ef94043b Bump bdk version to 1.0.0-alpha.12 (Steve Myers)

Pull request description:

  ### Description

  fixes #1449

  bdk_chain to 0.15.0
  bdk_bitcoind_rpc to 0.11.0
  bdk_electrum to 0.14.0
  bdk_esplora to 0.14.0
  bdk_persist to 0.3.0
  bdk_file_store to 0.12.0
  bdk_sqlite keep at 0.1.0
  bdk_testenv to 0.5.0
  bdk_hwi to 0.1.0
  bdk_wallet to 1.0.0-alpha.12

  ### Notes to the reviewers

  I also (hopefully) fixed the `bdk_hwi` crate so it can be published.

ACKs for top commit:
  ValuedMammal:
    ACK 108061dddbba99f03d7416a673135211ef94043b
  storopoli:
    ACK 108061dddbba99f03d7416a673135211ef94043b

Tree-SHA512: 2a80c51e254ca011b8e9bb72ad3d720dd8d09a3142e85cf230ffffad747257d91c45950cce64b049bab91f21c70c622f14d46def24ea78459497b42472a1fe48
v1.0.0-alpha.12
2024-05-23 17:38:49 -05:00
Steve Myers
108061dddb
Bump bdk version to 1.0.0-alpha.12
bdk_chain to 0.15.0
bdk_bitcoind_rpc to 0.11.0
bdk_electrum to 0.14.0
bdk_esplora to 0.14.0
bdk_persist to 0.3.0
bdk_file_store to 0.12.0
bdk_sqlite keep at 0.1.0
bdk_testenv to 0.5.0
bdk_hwi to 0.1.0
bdk_wallet to 1.0.0-alpha.12
2024-05-23 11:15:30 -05:00
Steve Myers
a2d940132d
Merge bitcoindevkit/bdk#1393: fix(export): add tr descriptor
1b7c6df569a0ff9324bbda1f066938490109481d fix(export): add tr descriptor (rustaceanrob)

Pull request description:

  ### Description

  Resolves #860 by adding export of taproot descriptors

  ### Notes to the reviewers

  Allows export as Core accepts taproot.

  ### Changelog notice

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

  #### New Features:

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

  #### Bugfixes:

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

ACKs for top commit:
  notmandatory:
    ACK 1b7c6df569a0ff9324bbda1f066938490109481d

Tree-SHA512: 80bee93a1ec531717e79a5e7a91e840532ae4d3daf677a207bc53162c69410e47db4893024b3eccfd848f1628062e7c49f0e92ebeb7230e2ebb9b47eb84b9e56
2024-05-23 10:19:01 -05:00
Steve Myers
2a055de555
Merge bitcoindevkit/bdk#1386: Remove TxBuilder allow_shrinking() and unneeded context param
096b8ef781b21e7da690b9ca2e4b326880d6ac0b fix(wallet): remove TxBuilder::allow_shrinking function and TxBuilderContext (Steve Myers)

Pull request description:

  ### Description

  Remove wallet::TxBuilder::allow_shrinking() and unneeded TxBuilder context param.

  Fixes #1374

  ### Notes to the reviewers

  The allow_shrinking function was the only one using the TxBuilder FeeBump context and it's useful to have CreateTx context  functions available for building FeeBump transactions, see updated tests.

  ### Changelog notice

  Changed

  - Removed TxBuilder::allow_shrinking() function.

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

Top commit has no ACKs.

Tree-SHA512: f4f05ce4cfaced9e61eebc0ebfe77a299fae13df4459fc26c90657297a1347a5d16f22b4e1c8b9b10458cfec80ca3b5d698eee11c7a560fd83f94a1ac7101a86
2024-05-23 10:08:45 -05:00
Steve Myers
096b8ef781
fix(wallet): remove TxBuilder::allow_shrinking function and TxBuilderContext 2024-05-23 09:45:49 -05:00
志宇
2eea0f4e90
Merge bitcoindevkit/bdk#1128: feat: add bdk_sqlite crate implementing PersistBackend
475c5024ecc5d288f35fabb8fab2b62dbf67653b feat(sqlite): add bdk_sqlite crate implementing PersistBackend backed by a SQLite database (Steve Myers)
b8aa76cd050bc3c2eac776ecbd9b4e2ab3e2590e feat(wallet): use the new `CombinedChangeSet` of `bdk_persist` (志宇)
0958ff56b20c1325a7da5d5f21e7ac836c601f1f feat(persist): introduce `CombinedChangeSet` (志宇)
54942a902d3203ee59731f35d2a1c402ac626878 ci: bump build_docs rust version to nightly-2024-05-12 (Steve Myers)
d975a48e7c519a703441e74058321021957b177f docs: update README MSRV pinning to match CI (Steve Myers)

Pull request description:

  ### Description

  Add "bdk_sqlite_store" crate implementing `PersistBackend` backed by a SQLite database.

  ### Notes to the reviewers

  In addition to adding a SQLite based `PersistenceBackend` this PR also:

  * add  `CombinedChangeSet` in `bdk_persist` and update `wallet` crate to use it.
  * updates the `wallet/tests` to also use this new sqlite store crate.
  * updates `example-crates/wallet_esplora_async` to use this new sqlite store crate.
  * fixes out of date README instructions for MSRV.
  * bumps the ci `build_docs` job to rust `nightly-2024-05-12`.

  ### Changelog notice

  Changed

  - Update Wallet to use CombinedChangeSet for persistence.

  Added

  - Add  CombinedChangeSet in bdk_persist crate.
  - Add bdk_sqlite crate implementing SQLite based PersistenceBackend storage for CombinedChangeSet.

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

Tree-SHA512: 72565127994fbfff34d7359e1d36d6f13e552995bb7ea61dd38ba5329b0d15e500fa106214a83fd870f1017dc659ff1bb8fc71bc6aad0a793730ec7f23179d8c
2024-05-23 22:34:24 +08:00
Steve Myers
475c5024ec
feat(sqlite): add bdk_sqlite crate implementing PersistBackend backed by a SQLite database 2024-05-23 08:59:45 -05:00