]> Untitled Git - bdk/log
bdk
3 years agoMerge bitcoindevkit/bdk#622: fix typo
Alekos Filini [Mon, 13 Jun 2022 09:44:35 +0000 (11:44 +0200)]
Merge bitcoindevkit/bdk#622: fix typo

a85ef62698eae748242f31db80fa3aabd3b2b64e fix typo (Buck Perley)

Pull request description:

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

  ### Description

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

  ### Notes to the reviewers

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

  ### 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:
  rajarshimaitra:
    ACK a85ef62698eae748242f31db80fa3aabd3b2b64e
  afilini:
    ACK a85ef62698eae748242f31db80fa3aabd3b2b64e

Tree-SHA512: 089de23adae62492a0b39a27c9cb8cb8afc99e5634194118681b8a9a46ff0b073558f9cd515cd4db4c9c6e6f9c813bfa4b193d4e3f9558b34ad29cbd46cf028c

3 years agoMerge commit 'refs/pull/629/head' of github.com:bitcoindevkit/bdk
Steve Myers [Fri, 10 Jun 2022 17:46:27 +0000 (10:46 -0700)]
Merge commit 'refs/pull/629/head' of github.com:bitcoindevkit/bdk

3 years agoBump version to 0.19.1-dev github/release/0.19.0
Steve Myers [Fri, 10 Jun 2022 17:13:43 +0000 (10:13 -0700)]
Bump version to 0.19.1-dev

3 years agoBump version to 0.19.0 v0.19.0
Steve Myers [Fri, 10 Jun 2022 16:08:43 +0000 (09:08 -0700)]
Bump version to 0.19.0

3 years agoUpdate CHANGELOG.md to 0.19.0
Steve Myers [Wed, 8 Jun 2022 22:18:54 +0000 (15:18 -0700)]
Update CHANGELOG.md to 0.19.0

3 years agoMerge bitcoindevkit/bdk#623: Bump versions
Alekos Filini [Wed, 8 Jun 2022 10:59:15 +0000 (12:59 +0200)]
Merge bitcoindevkit/bdk#623: Bump versions

3283a200bc5fef4bca38954abad669130125f70c Bump rusqlite (Philipp Hoenisch)
3f9b4cdca9dc05d3e8f63df7235287e192a1838a Bump ahash (Philipp Hoenisch)

Pull request description:

  ### Description

  Not much to say besides that I bumped some version which helps us to resolve some dependency hell :)

  ### Notes to the reviewers

  `ahash` was previously fixed because of an incompatibility with the defined MSRV. The MSRV has been bumped to 1.56 so we can update the dependency.

  ### 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
  * [ ] I've updated `CHANGELOG.md`

  #### 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:
  rajarshimaitra:
    ACK 3283a200bc5fef4bca38954abad669130125f70c

Tree-SHA512: 4760890529bb4dd87fafdda04188fd06e707398abfa7d36d26077233525e76cc8c7d8888ad996c1cc4ac31ab708ea9a56a602b1d1578b97f9e44b610df3d969b

3 years agoBump version to 0.19.0-rc.1
Steve Myers [Tue, 7 Jun 2022 20:13:23 +0000 (13:13 -0700)]
Bump version to 0.19.0-rc.1

3 years agoMerge bitcoindevkit/bdk#628: rpc: use `importdescriptors` with Core >= 0.21
Steve Myers [Tue, 7 Jun 2022 20:00:46 +0000 (13:00 -0700)]
Merge bitcoindevkit/bdk#628: rpc: use `importdescriptors` with Core >= 0.21

e1a1372baec86da784af697e025615b8e0bccf4e rpc: use `importdescriptors` with Core >= 0.21 (Alekos Filini)

Pull request description:

  ### Description

  Only use the old `importmulti` with Core versions that don't support descriptor-based (sqlite) wallets.

  Add an extra feature to test against Core 0.20 called `test-rpc-legacy`.

  This also makes us compatible with Core 23.0 and is thus a replacement for #613, which actually looking back at it was adding support for 23.0 but probably breaking older wallets by adding the extra argument to `createwallet`.

  I believe #613 should now only focus on getting the tests to work against 23.0, which is still important but not such a high priority as being compatible with the latest version of Core.

  Also fixes #598

  ### 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
  * [x] I've updated `CHANGELOG.md`

ACKs for top commit:
  notmandatory:
    ACK e1a1372baec86da784af697e025615b8e0bccf4e

Tree-SHA512: 7891b8ab2fc900ea2a186f64a32aea970f28a50339063ed0e1a8d13248e5c038b8fff3d9e26b93cb7daafd0c873379e64a28836dbe4e4b82f1983577a88971ff

3 years agorpc: use `importdescriptors` with Core >= 0.21
Alekos Filini [Tue, 7 Jun 2022 11:14:52 +0000 (13:14 +0200)]
rpc: use `importdescriptors` with Core >= 0.21

Only use the old `importmulti` with Core versions that don't support
descriptor-based (sqlite) wallets.

Add an extra feature to test against Core 0.20 called `test-rpc-legacy`

3 years agoBump rusqlite
Philipp Hoenisch [Mon, 6 Jun 2022 00:57:50 +0000 (10:57 +1000)]
Bump rusqlite

Signed-off-by: Philipp Hoenisch <philipp@hoenisch.at>
3 years agoBump ahash
Philipp Hoenisch [Mon, 6 Jun 2022 00:57:09 +0000 (10:57 +1000)]
Bump ahash

We can upgrade this now as MSRV was bumped to 1.56

Signed-off-by: Philipp Hoenisch <philipp@hoenisch.at>
3 years agofix typo
Buck Perley [Sun, 5 Jun 2022 17:06:13 +0000 (12:06 -0500)]
fix typo

3 years agoMerge bitcoindevkit/bdk#619: Fix index out of bound error
Steve Myers [Sun, 5 Jun 2022 17:12:47 +0000 (10:12 -0700)]
Merge bitcoindevkit/bdk#619: Fix index out of bound error

d9b9b3dc464d6a9cd4157cc4135a2e7b88ce4ab3 Fix InvalidColumnIndex error (Philipp Hoenisch)

Pull request description:

  This query returns 7 rows, so last row is index 6

  ### 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:
  danielabrozzoni:
    tACK d9b9b3dc464d6a9cd4157cc4135a2e7b88ce4ab3
  rajarshimaitra:
    tACK d9b9b3dc464d6a9cd4157cc4135a2e7b88ce4ab3

Tree-SHA512: 8a3d8a291daa4af86a2a2eacc31f002972dd9cdb9bf300a4b09e2e015c4a967dc4fa7e925afbcce8b104a01e1d7f7c8cb0badda8e1ac5ade511681f490c719d5

3 years agoMerge bitcoindevkit/bdk#593: Add support for Taproot and `tr()` descriptors
Alekos Filini [Fri, 3 Jun 2022 14:42:51 +0000 (16:42 +0200)]
Merge bitcoindevkit/bdk#593: Add support for Taproot and `tr()` descriptors

20d36c71d470ea5ece98dd218f4dbdb0ba872d11 Update CHANGELOG.md for Taproot (Alekos Filini)
ef08fbd3c7f424cb77e231c2daaed2039b28b938 Update to the newest release of rust-bitcoin (Alekos Filini)
5320c8353e05adecf0d18336d48934567257e64d taproot-tests: validate `tap_tree` in psbt outputs (Alekos Filini)
c1bfaf9b1ebd92ac8952afd0d5867897672acfb4 Add blockchain tests for parsing, signing, finalizing taproot core psbts (Steve Myers)
0643f76c1fac5ee25f8a9de4c3a2cd57a3974b5e taproot-tests: Add tests for the policy module (Alekos Filini)
89cb425e69303fe62fe7332d8528011b7a98b4df taproot-tests: Add test coverage for tx signing (Alekos Filini)
461397e590471a8d10590b7d754e206310bceef5 taproot-tests: Test taproot key and script spend in the blockchain tests (Alekos Filini)
c67116fb55de525a9045527eefcb5cdb6f4d34a9 policy: Consider `tap_key_origins` when looking for sigs in PSBTs (Alekos Filini)
572c3ee70d6d335af0e2e541d2497f8bdcfb63c9 policy: Build `SatisfiableItem::*Signature` based on the context (Alekos Filini)
ff1abc63e03e5c24d375eb2c4f20302c9187d24d policy: Refactor `PkOrF` into an enum (Alekos Filini)
308708952b598f8f0f1f6cb5f3743e443485cb1e Fix type inference for the `tr()` descriptor, add basic tests (Alekos Filini)
fe1877fb185af7a235ceb1a9696d1edd66f957d8 Support `tr()` descriptors in dsl (Alekos Filini)
cdc7057813a4a2acba5224c966da2c3473efa669 Add `tr()` descriptors to the `descriptor!()` macro (Alekos Filini)
c121dd0252f392ac4bd5e787c9cb570dedcec478 Use `tap_key_origins` in PSBTs to derive descriptors (Alekos Filini)
855382113380612ca4f4c7da0a4a93c7a4f9aab9 Populate more taproot fields in PSBTs (Alekos Filini)
8a5a87b0752e0bdaa003ff7c3f1d153a447dbe85 Populate `tap_key_origin` in PSBT inputs and outputs (Alekos Filini)
1312184ed7a9c5c7a6f99cf8bb08d43775ba5083 Attach a context to our software signers (Alekos Filini)
906598ad9254643a204df7711693dcc0a73a0332 Refactor signer traits, add support for taproot signatures (Alekos Filini)

Pull request description:

  ### Description

  This is a work-in-progress PR to update BDK to rust-bitcoin `0.28` which introduces taproot support and a few other improvements. While updating we also introduce taproot support in BDK.

  High level list of subtasks for this PR:
  - [x] Update rust-bitcoin and rust-miniscript
  - [x] Stop using deprecated structs
  - [x] Add taproot metadata to psbts
  - [x] Produce schnorr signatures
  - [x] Finalize taproot txs
  - [x] Support `tr()` descriptors in the `descriptor!()` macro
  - [x] Write a lot of tests
    - [x] Interoperability with other wallets (Core + ?)
       - [x] Signing/finalizing a psbt made by core
       - [x] Producing a psbt that core can sign and finalize
    - [x] Creating psbts
      - [x] Verify the metadata are correct
      - [x] Verify sighashes are applied correctly
      - [x] Create a tx with a foreign taproot and non-taproot utxo
    - [x] Signing psbts
      - [x] Signing for a key spend
      - [x] Signing for a script spend
      - [x] Signing with a single (wif) key
      - [x] Signing with an xprv (with and without knowing the utxo being spent in the db)
      - [x] Signing with weird sighashes
    - [x] Policy module
      - [x] Simple key spend
      - [x] More complex tap tree with a few keys
      - [x] Verify both `contribution` and `satisfaction` of a PSBT input
    - [x] Wallet module
      - [x] Generate addresses

  Fixes #63

  ### Notes to the reviewers

  #### Milestone

  I'm adding this to the `0.19` milestone because now that rust-bitcoin and rust-miniscript have been released we should not waiting too long to release a version of BDK that supports the new libraries.

  #### API Breaks

  Since this is an API-break because of the new version of rust-bitcoin and rust-miniscript, I'm also taking the chance to update a few things in our lib that I had been thinking about for a while.

  One example is the signer interface, which had that weird `sign_whole_tx()` method. This has now been removed, and the `Signer` trait replaced with `TransactionSigner` and `InputSigner`. I'm also starting to think that the signer should not only look at the psbt to figure out what to do, but ideally it should also receive some information about the descriptor (for example, the type) to simplify the code.

  One option is to add an extra parameter, but that would probably only be used by our internal signers and not much else (for example, if you ask an hardware wallet to sign, it will probably already know what kind of wallet you have).

  Another option is to wrap `PrivateKey` and `DescriptorXKey<ExtendedPrivKey>` which are the two internal signers we support with a struct that contains metadata about the descriptor, and then implement the signer traits on that struct. We could construct this in `Wallet::new()`, after miniscript parses the descriptor.

  #### MSRV Bump

  Due to the update of `rust-electrum-client`, which in turn depends on an updated `webpki`, we will have to bump our MSRV beacuse 1.46 is not supported by the new `webpki` version.

  ### 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 docs for the new feature
  * [ ] I've updated `CHANGELOG.md`

Top commit has no ACKs.

Tree-SHA512: 44ec6c4e7fe0bc87862bb76581ddae7905c8796a4a130c90b48b73b4b7d01ea1a20043b8a0ff449fc2db2f7aecc490def8daee2d420809ded1ece7f085a48f55

3 years agoFix InvalidColumnIndex error
Philipp Hoenisch [Fri, 3 Jun 2022 05:28:43 +0000 (15:28 +1000)]
Fix InvalidColumnIndex error

This query returns 7 columns, so last columns is index 6

3 years agoUpdate CHANGELOG.md for Taproot
Alekos Filini [Wed, 1 Jun 2022 12:55:43 +0000 (14:55 +0200)]
Update CHANGELOG.md for Taproot

3 years agoUpdate to the newest release of rust-bitcoin
Alekos Filini [Wed, 1 Jun 2022 12:50:08 +0000 (14:50 +0200)]
Update to the newest release of rust-bitcoin

3 years agotaproot-tests: validate `tap_tree` in psbt outputs
Alekos Filini [Tue, 31 May 2022 15:47:26 +0000 (17:47 +0200)]
taproot-tests: validate `tap_tree` in psbt outputs

Co-authored-by: Daniela Brozzoni <danielabrozzoni@protonmail.com>
3 years agoAdd blockchain tests for parsing, signing, finalizing taproot core psbts
Steve Myers [Wed, 25 May 2022 02:26:41 +0000 (19:26 -0700)]
Add blockchain tests for parsing, signing, finalizing taproot core psbts

3 years agotaproot-tests: Add tests for the policy module
Alekos Filini [Tue, 24 May 2022 09:49:31 +0000 (11:49 +0200)]
taproot-tests: Add tests for the policy module

3 years agotaproot-tests: Add test coverage for tx signing
Alekos Filini [Wed, 18 May 2022 17:55:21 +0000 (19:55 +0200)]
taproot-tests: Add test coverage for tx signing

3 years agotaproot-tests: Test taproot key and script spend in the blockchain tests
Alekos Filini [Wed, 18 May 2022 09:36:15 +0000 (11:36 +0200)]
taproot-tests: Test taproot key and script spend in the blockchain tests

This is to ensure a Bitcoin node accepts our transactions

3 years agopolicy: Consider `tap_key_origins` when looking for sigs in PSBTs
Alekos Filini [Tue, 24 May 2022 13:50:49 +0000 (15:50 +0200)]
policy: Consider `tap_key_origins` when looking for sigs in PSBTs

We used to only look at `bip32_derivations` which is only used for ECDSA
keys.

3 years agopolicy: Build `SatisfiableItem::*Signature` based on the context
Alekos Filini [Tue, 24 May 2022 09:24:48 +0000 (11:24 +0200)]
policy: Build `SatisfiableItem::*Signature` based on the context

Also refactor our code to lookup signatures in PSBTs to use the context

3 years agopolicy: Refactor `PkOrF` into an enum
Alekos Filini [Tue, 24 May 2022 08:39:17 +0000 (10:39 +0200)]
policy: Refactor `PkOrF` into an enum

For whatever reason we were using a struct as an enum, so we might as
well fix it in this PR since we are already breaking the API quite
badly.

3 years agoFix type inference for the `tr()` descriptor, add basic tests
Alekos Filini [Fri, 29 Apr 2022 14:08:03 +0000 (16:08 +0200)]
Fix type inference for the `tr()` descriptor, add basic tests

3 years agoSupport `tr()` descriptors in dsl
Alekos Filini [Fri, 29 Apr 2022 13:38:45 +0000 (15:38 +0200)]
Support `tr()` descriptors in dsl

3 years agoAdd `tr()` descriptors to the `descriptor!()` macro
Alekos Filini [Sat, 13 Nov 2021 14:39:34 +0000 (15:39 +0100)]
Add `tr()` descriptors to the `descriptor!()` macro

3 years agoUse `tap_key_origins` in PSBTs to derive descriptors
Alekos Filini [Fri, 29 Apr 2022 10:59:09 +0000 (12:59 +0200)]
Use `tap_key_origins` in PSBTs to derive descriptors

3 years agoPopulate more taproot fields in PSBTs
Alekos Filini [Thu, 28 Apr 2022 13:39:31 +0000 (15:39 +0200)]
Populate more taproot fields in PSBTs

3 years agoPopulate `tap_key_origin` in PSBT inputs and outputs
Alekos Filini [Wed, 27 Apr 2022 14:29:02 +0000 (16:29 +0200)]
Populate `tap_key_origin` in PSBT inputs and outputs

3 years agoAttach a context to our software signers
Alekos Filini [Thu, 12 May 2022 15:28:41 +0000 (17:28 +0200)]
Attach a context to our software signers

This allows the signer to know the signing context precisely without
relying on heuristics on the psbt fields.

Due to the context being static, we still have to look at the PSBT when
producing taproot signatures to determine the set of leaf hashes that
the key can sign for.

3 years agoRefactor signer traits, add support for taproot signatures
Alekos Filini [Tue, 26 Apr 2022 14:54:10 +0000 (16:54 +0200)]
Refactor signer traits, add support for taproot signatures

3 years agoMerge bitcoindevkit/bdk#605: Fix sqlite database set_utxo to insert or update utxos
Steve Myers [Tue, 24 May 2022 15:18:55 +0000 (08:18 -0700)]
Merge bitcoindevkit/bdk#605: Fix sqlite database set_utxo to insert or update utxos

35feb107ed5969720ce54a6aa76b7b2176f6c7c1 [CI] Fix cont_integration test-blockchains to run all tests (Steve Myers)
24719081511969299459d01566b0d669a7b51f7b Update CHANGELOG with warning about sqlite-db deleted wallet data (Steve Myers)
0b1a399f4e556a981bb992cc9b1d34318e260a7c Update sqlite schema with unique index for utxos, change insert_utxo to upsert (Steve Myers)
cea79872d717b395560a344cc4dd0e022c3bd9a9 Update database tests to verify set_utxo upserts (Steve Myers)

Pull request description:

  ### Description

  This PR fixes #591 by:
  1. Add sqlite `MIGRATIONS` statements to remove duplicate utxos and add unique utxos index on txid and vout.
  2. Do an upsert (if insert fails update) instead of an insert in `set_utxo()`.
  3. Update database::test::test_utxo to also verify `set_utxo()` doesn't insert duplicate utxos.

  ### Notes to the reviewers

  I verified the updated `test_utxo` fails as expected before my fix and passes after the fix. I tested the new migrations using the below `bdk-cli` command and a manually updated sqlite db with duplicate utxos.
  ```shell
  cargo run --no-default-features --features cli,sqlite-db,esplora-ureq -- wallet -w test1 --descriptor "wpkh(tpubEBr4i6yk5nf5DAaJpsi9N2pPYBeJ7fZ5Z9rmN4977iYLCGco1VyjB9tvvuvYtfZzjD5A8igzgw3HeWeeKFmanHYqksqZXYXGsw5zjnj7KM9/*)" sync
  ```

  ### 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
  * [ ] I've updated `CHANGELOG.md`

  #### 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 35feb107ed5969720ce54a6aa76b7b2176f6c7c1 - Code looks good, but I didn't do any local test to see if the db gets wiped

Tree-SHA512: 753c7a0cfd0e803b5e12f39181d9a718791c4ce229d5072e6498db75a7008e94d447b3d0b4b0c205e7a8f127f60102e12bac2d271b8bad3a3038856bfd54e99c

3 years agoMerge bitcoindevkit/bdk#610: Populate the redeemScript for `sh(wsh(sortedmulti()))`
Alekos Filini [Tue, 24 May 2022 08:14:36 +0000 (10:14 +0200)]
Merge bitcoindevkit/bdk#610: Populate the redeemScript for `sh(wsh(sortedmulti()))`

82de8b50da6e8b9752332b80da395c792c371def Populate the redeemScript for `sh(wsh(sortedmulti()))` (Alekos Filini)

Pull request description:

  ### Description

  Also explicitly match all the individual variants to ensure a similar problem
  doesn't happen again.

  Fixes #609

  ### Checklists

  #### All Submissions:

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

  #### Bugfixes:

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

ACKs for top commit:
  notmandatory:
    ACK 82de8b50da6e8b9752332b80da395c792c371def

Tree-SHA512: 7cccae44679089b70e8d9df466a165debe17c4cf30ae11cb27357fbda830d3d7ce53161e414b354b1f2be46efe413b8e44132f5e6d625298b740d44112ca286a

3 years agoPopulate the redeemScript for `sh(wsh(sortedmulti()))`
Alekos Filini [Mon, 23 May 2022 19:01:28 +0000 (21:01 +0200)]
Populate the redeemScript for `sh(wsh(sortedmulti()))`

Also explicitly match all the individual variants to ensure a similar problem
doesn't happen again.

Fixes #609

3 years ago[CI] Fix cont_integration test-blockchains to run all tests
Steve Myers [Thu, 19 May 2022 21:00:40 +0000 (14:00 -0700)]
[CI] Fix cont_integration test-blockchains to run all tests

3 years agoUpdate CHANGELOG with warning about sqlite-db deleted wallet data
Steve Myers [Wed, 18 May 2022 20:44:57 +0000 (13:44 -0700)]
Update CHANGELOG with warning about sqlite-db deleted wallet data

3 years agoUpdate sqlite schema with unique index for utxos, change insert_utxo to upsert
Steve Myers [Thu, 12 May 2022 00:33:32 +0000 (17:33 -0700)]
Update sqlite schema with unique index for utxos, change insert_utxo to upsert

3 years agoUpdate database tests to verify set_utxo upserts
Steve Myers [Thu, 12 May 2022 01:04:18 +0000 (18:04 -0700)]
Update database tests to verify set_utxo upserts

3 years agoMerge bitcoindevkit/bdk#604: unpinning dependency tokio to just 1
Steve Myers [Tue, 17 May 2022 18:13:19 +0000 (11:13 -0700)]
Merge bitcoindevkit/bdk#604: unpinning dependency tokio to just 1

939a1156c65d0f347cb4397e0883573737d39761 unpinning dependency tokio to 1 (Richard Ulrich)

Pull request description:

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

  ### Description

  unpinning dependency tokio to just 1

  ### Checklists

  #### All Submissions:

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

  #### New Features:

  * [ ] I've added tests for the new feature
  * [ ] I've added docs for the new feature
  * [x] I've updated `CHANGELOG.md`

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

Tree-SHA512: 7b33522411f6b63d844d12cc86c8992aa4105c29e91dbef67362a6c600f3ef39e802ff5893054bf8feeb7fa5bf383765025096cbc2ccb9a6b83bc5c919a5a43d

3 years agounpinning dependency tokio to 1
Richard Ulrich [Mon, 9 May 2022 14:28:50 +0000 (16:28 +0200)]
unpinning dependency tokio to 1

3 years agoMerge bitcoindevkit/bdk#606: Upgrade to rust-bitcoin 0.28
Alekos Filini [Thu, 12 May 2022 18:29:41 +0000 (20:29 +0200)]
Merge bitcoindevkit/bdk#606: Upgrade to rust-bitcoin 0.28

00164588f2ddab91bb4468ec010dc1bbca277eb5 Stop using deprecated structs (Alekos Filini)
a16c18255ceb3e13ff92ee41b2b6f6510491eeb8 Upgrade to rust-bitcoin 0.28 and miniscript 7.0 (Alekos Filini)

Pull request description:

  ### Description

  Upgrade all our dependencies to work with the new release of rust-bitcoin

  ### Notes to the reviewers

  The commits in this pr were originally part of #593

  ### 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 updated `CHANGELOG.md`

ACKs for top commit:
  rajarshimaitra:
    ACK 00164588f2ddab91bb4468ec010dc1bbca277eb5

Tree-SHA512: eef7e94246e619686b4dfffd6e4cb685630fe2eaf9447f2f0b49ed2643d67f81c50e0d89b66267db4552a05e58f638d885eb7056270648403f716803fce9e275

3 years agoStop using deprecated structs
Alekos Filini [Tue, 26 Apr 2022 13:11:22 +0000 (15:11 +0200)]
Stop using deprecated structs

3 years agoUpgrade to rust-bitcoin 0.28 and miniscript 7.0
Alekos Filini [Thu, 14 Apr 2022 15:20:46 +0000 (17:20 +0200)]
Upgrade to rust-bitcoin 0.28 and miniscript 7.0

3 years agoMerge bitcoindevkit/bdk#569: [blockchain] Add traits to reuse `Blockchain`s across...
Steve Myers [Wed, 11 May 2022 04:31:50 +0000 (21:31 -0700)]
Merge bitcoindevkit/bdk#569: [blockchain] Add traits to reuse `Blockchain`s across multiple wallets

8795da48397800effeffae8417c6e749ec488212 wallet: Move `wallet_name_from_descriptor` above the tests (Alekos Filini)
9c405e9c70e417dea0e610f9d44e99911d6b4e44 [blockchain] Add traits to reuse `Blockchain`s across multiple wallets (Alekos Filini)
2d83af49051f5d33105315164f3edf7f72f3741f Move testutils macro module before the others (Alekos Filini)

Pull request description:

  ### Description

  Add three new traits:
  - `StatelessBlockchain` is used to tag `Blockchain`s that don't have any wallet-specic state, i.e. they can be used as-is to sync multiple wallets.
  - `StatefulBlockchain` is the opposite of `StatelessBlockchain`: it provides a method to "clone" a `Blockchain` with an updated internal state (a new wallet checksum and, optionally, a different number of blocks to skip from genesis). Potentially this also allows reusing the underlying connection on `Blockchain` types that support it.
  - `MultiBlockchain` is a generalization of this concept: it's implemented automatically for every type that implements `StatefulBlockchain` and for every `Arc<T>` where `T` is a `StatelessBlockchain`. This allows a piece of code that deals with multiple sub-wallets to just get a `&B: MultiBlockchain` without having to deal with stateful and statless blockchains individually.

  These new traits have been implemented for Electrum, Esplora and RPC (the first two being stateless and the latter stateful). It hasn't been implemented on the CBF blockchain, because I don't think it would work in its current form (it throws away old block filters, so it's hard to go back and rescan).

  This is the first step for #549, as BIP47 needs to sync many different descriptors internally.

  It's also very useful for #486.

  ### Notes to the reviewers

  This is still a draft because:
  - I'm still wondering if these traits should "inherit" from `Blockchain` instead of the less-restrictive `WalletSync` + `GetHeight` which is the bare minimum to sync a wallet
  - I need to write tests, at least for rpc which is stateful
  - I need to add 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
  * [x] I've updated `CHANGELOG.md`

ACKs for top commit:
  rajarshimaitra:
    tACK 8795da48397800effeffae8417c6e749ec488212

Tree-SHA512: 03f3b63d51199b26a20d58cf64929fd690e2530f873120291a7ffea14a6237334845ceb37bff20d6c5466fca961699460af42134d561935d77b830e2e131df9d

3 years agoMerge bitcoindevkit/bdk#602: wrong Network path fixed
Alekos Filini [Tue, 10 May 2022 15:25:50 +0000 (17:25 +0200)]
Merge bitcoindevkit/bdk#602: wrong Network path fixed

b4100a71896cdbd7cf2c38cdce9f846ea74b6d44 wrong Network path fixed (Pedro Felix)

Pull request description:

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

  ### Description
  This change needs to be made for this example to compile correctly.
  <!-- Describe the purpose of this PR, what's being adding and/or fixed -->

  ### Notes to the reviewers

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

  ### 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
  * [ ] I've updated `CHANGELOG.md`

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

Tree-SHA512: b4b7d186cabc7b3ed2d5b6411414d56eeee09c4e8d9d704a26f8817d6573b6b182d7ef1ff8139b6f4f6fb3e4ec99c2c09758804a6bb25051e45b0885c0def5e3

3 years agowallet: Move `wallet_name_from_descriptor` above the tests
Alekos Filini [Fri, 15 Apr 2022 20:12:34 +0000 (22:12 +0200)]
wallet: Move `wallet_name_from_descriptor` above the tests

3 years ago[blockchain] Add traits to reuse `Blockchain`s across multiple wallets
Alekos Filini [Tue, 15 Mar 2022 09:48:00 +0000 (10:48 +0100)]
[blockchain] Add traits to reuse `Blockchain`s across multiple wallets

Add two new traits:
- `StatelessBlockchain` is used to tag `Blockchain`s that don't have any
  wallet-specic state, i.e. they can be used as-is to sync multiple wallets.
- `BlockchainFactory` is a trait for objects that can build multiple
  blockchains for different descriptors. It's implemented automatically
  for every `Arc<T>` where `T` is a `StatelessBlockchain`. This allows a
  piece of code that deals with multiple sub-wallets to just get a
  `&B: BlockchainFactory` to sync all of them.

These new traits have been implemented for Electrum, Esplora and RPC
(the first two being stateless and the latter having a dedicated
`RpcBlockchainFactory` struct). It hasn't been implemented on the CBF
blockchain, because I don't think it would work in its current form
(it throws away old block filters, so it's hard to go back and rescan).

This is the first step for #549, as BIP47 needs to sync many different
descriptors internally.

It's also very useful for #486.

3 years agoMove testutils macro module before the others
Alekos Filini [Wed, 23 Mar 2022 11:00:24 +0000 (12:00 +0100)]
Move testutils macro module before the others

This allows using the `testuitils` macro in their tests as well

3 years agowrong Network path fixed
Pedro Felix [Fri, 6 May 2022 16:03:35 +0000 (09:03 -0700)]
wrong Network path fixed

Signed-off-by: Pedro Felix <NEWAGAIN@Pedros-MacBook-Pro.local>
Signed-off-by: Pedro Felix <p.felixgarcia@gmail.com>
3 years agoMerge bitcoindevkit/bdk#600: Change wallet::get_funded_wallet to return Wallet<AnyDat...
Alekos Filini [Fri, 6 May 2022 08:28:37 +0000 (10:28 +0200)]
Merge bitcoindevkit/bdk#600: Change wallet::get_funded_wallet to return Wallet<AnyDatabase>

e7a56a92685ce1948d2ec7232fccd7e072d4abb3 Change wallet::get_funded_wallet to return Wallet<AnyDatabase> (Steve Myers)

Pull request description:

  ### Description

  Change testing function `wallet::get_funded_wallet` to return `Wallet<AnyDatabase>` instead of `Wallet<MemoryDatabase>`. This will allow us to use this function for testing `bdk-ffi` which only works with `Wallet<AnyDatabase>`.

  ### Notes to the reviewers

  This is required to complete https://github.com/bitcoindevkit/bdk-ffi/pull/148.

  ### 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
  * [ ] I've updated `CHANGELOG.md`

  #### 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:
  afilini:
    ACK e7a56a92685ce1948d2ec7232fccd7e072d4abb3

Tree-SHA512: 47b53ab6dcee63fc7b24666d3cf9a0ad832782081dd2fe92961c8c9b4c302df90db96b0b518af71d6cbc85319434971219100f8cedb35ce7212d944db29a4295

3 years agoMerge bitcoindevkit/bdk#599: Fix typo in docs for TxBuilder allow_shrinking method
Alekos Filini [Fri, 6 May 2022 08:26:49 +0000 (10:26 +0200)]
Merge bitcoindevkit/bdk#599: Fix typo in docs for TxBuilder allow_shrinking method

4628a10191f451a7b0ade674e9f8568bf695e49c Fix typo in docs for TxBuilder allow_shrinking method (thunderbiscuit)

Pull request description:

  ### Description
  This PR fixes a small typo in the documentation for the `allow_shrinking()` method on the `TxBuilder`.

  ### Notes to the reviewers
  The sentence
  ```txt
  Explicitly tells the wallet that it is allowed to reduce the fee of the output matching this `script_pubkey` in order to bump the transaction fee. Without specifying this the wallet will attempt to find a change output to shrink instead.
  ```
  was changed for
  ```txt
  Explicitly tells the wallet that it is allowed to reduce the amount of the output matching this `script_pubkey` in order to bump the transaction fee. Without specifying this the wallet will attempt to find a change output to shrink instead.
  ```

  To reflect the fact that it's the _amount_ of the output that is being reduced in order to leave more for the fees.

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

Tree-SHA512: ca135764d78144295fdbdb4673ca6dec153c6f83ee7fb5d7d3051e0d46b04d23b2f3c3fd66e44491da842c778e72b52f8996d00e4c20986d7ccb11587f0d7d27

3 years agoChange wallet::get_funded_wallet to return Wallet<AnyDatabase>
Steve Myers [Thu, 5 May 2022 23:42:56 +0000 (16:42 -0700)]
Change wallet::get_funded_wallet to return Wallet<AnyDatabase>

3 years agoFix typo in docs for TxBuilder allow_shrinking method
thunderbiscuit [Thu, 5 May 2022 19:15:04 +0000 (15:15 -0400)]
Fix typo in docs for TxBuilder allow_shrinking method

3 years agoMerge bitcoindevkit/bdk#596: Bump MSRV to 1.56
Steve Myers [Wed, 4 May 2022 16:55:19 +0000 (09:55 -0700)]
Merge bitcoindevkit/bdk#596: Bump MSRV to 1.56

cca69481eb7edb28532a4ed78185248d410050ac Bump MSRV to 1.56 (Alekos Filini)

Pull request description:

  ### Description

  Following the discussion in #331, bump the MSRV to `1.56`. We already have other PRs bumping it to at least `1.51` (#593), but I'm felling like we are always lagging behind and our CI breaks regularly. As @LLFourn suggested, this PR makes a relatively large bump, hoping this buys us enough time to finish splitting up BDK, which will allow us to have a lower MSRV for the "core" crate.

  ### 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 updated `CHANGELOG.md`

ACKs for top commit:
  notmandatory:
    ACK cca69481eb7edb28532a4ed78185248d410050ac

Tree-SHA512: bc6572dc94e1c4cbb6d21f6e06a9730af5763fb4811311a61a6a6ec850b5a65664a21e4a7070a3ebcd702529fbba97b2e9a43c1277b9b9f092e194f16a39bc1a

3 years agoBump MSRV to 1.56
Alekos Filini [Tue, 3 May 2022 10:41:22 +0000 (12:41 +0200)]
Bump MSRV to 1.56

3 years agoMerge bitcoindevkit/bdk#557: add OldestFirstCoinSelection
Alekos Filini [Mon, 25 Apr 2022 14:45:43 +0000 (16:45 +0200)]
Merge bitcoindevkit/bdk#557: add OldestFirstCoinSelection

6931d0bd1f044bf73c0cb760c0eb0be19aea8de1 add private function select_sorted_utxso to be resued by multiple CoinSelection impl (KaFai Choi)
545beec743412717895d0ba5d32ccd9aac68f4a6 add OldestFirstCoinSelection (KaFai Choi)

Pull request description:

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

  ### Description
  This PR is to add `OldestFirstCoinSelection`. See this issue for detail https://github.com/bitcoindevkit/bdk/issues/120
  <!-- Describe the purpose of this PR, what's being adding and/or fixed -->

  ### Notes to the reviewers
  Apologize in advance if the quality of this PR is too low.(I am newbie in both bitcoin wallet and rust).

  While this PR seemed very straight-forward to me in the first glance, it's actually a bit more complicated than I thought as it involves calling DB get the blockheight before sorting it.

  The current implementation should be pretty naive but I would like to get some opinion to see if I am heading to a right direction first before working on optimizations like

  ~~1. Avoiding calling DB for optional_utxos if  if the amount from required_utxos are already enough.~~ Probably not worth to do such optimization to keep code simpler?

  ### 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
  * [x] I've updated `CHANGELOG.md`

  #### 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:
  afilini:
    ACK 6931d0bd1f044bf73c0cb760c0eb0be19aea8de1

Tree-SHA512: d297bbad847d99cfdd8c6b1450c3777c5d55bc51c7934f287975c4d114a21840d428a75a172bfb7eacbac95413535452b644cab971efb8c0b5caf0d06d6d8356

3 years agoMerge bitcoindevkit/bdk#582: Expose bip39::Error
Alekos Filini [Mon, 25 Apr 2022 14:14:38 +0000 (16:14 +0200)]
Merge bitcoindevkit/bdk#582: Expose bip39::Error

c752ccbddeaa5ae441cc74a1386c1e412a447104 Expose bip39::Error (志宇)

Pull request description:

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

  ### Description

  Expose `bip39::Error` (fixes #581 )

  ### Notes to the reviewers

  I am aware that the `bip39` module plans to be rewritten (as per #561 ), however this seems like a rather straightforward and quick change that may be useful in the short/mid term.

  ### Checklists

  #### Bugfixes:

  * [x] Expose `bip39::Error`

ACKs for top commit:
  afilini:
    ACK c752ccbddeaa5ae441cc74a1386c1e412a447104

Tree-SHA512: 98b7ac1ba88aed07d9160830ee80496c32d531c15ada0e9b50a97f0883fbfced22fa83a7c7f8366aadb7e7a667d8a63dde869d31cc375206d277e55b2ec3089d

3 years agoMerge bitcoindevkit/bdk#584: Release 0.18.0
Alekos Filini [Thu, 21 Apr 2022 15:17:12 +0000 (17:17 +0200)]
Merge bitcoindevkit/bdk#584: Release 0.18.0

b5c8ce924bc47d26a0d577bfcbdaf241c56aa253 Bump version to 0.19.0-dev (Steve Myers)
e3ce50059fca2d58587fdf4dd806ffacfef3d302 Bump version to 0.18.0 (Steve Myers)
8a2a6bbceeec3f682c789537ca619da821d34732 Add `n:` wrapper to vulnerable scripts (Alekos Filini)
122e6e71405f65ecb3c75adaff1e35ab5ef3a06e Bump 'miniscript' dependency version to '^6.1' (Steve Myers)
9ed36875f1112d884f6c3c2beab89faf8aa5d2e0 export: Rename `WalletExport` to `FullyNodedExport` (Alekos Filini)
f90e3f978e3c7ec5dde0a592d79da419a7c9ec3a Update changelog with addition of keychain to AddressInfo (Steve Myers)
68e1b32d81978746dba0abdd14af94edbfdcf9b4 Bump version to 0.18.0-rc.1 (Steve Myers)

Pull request description:

  ### Description

  Release 0.18.0.

  ### Notes to the reviewers

  This branch also includes the following changes which are not yet in the `master` branch:

  - Rename `WalletExport` to `FullyNodedExport`, deprecate the former.
  - Bump `miniscript` dependency version to `^6.1`.

  ### Checklists

  #### All Submissions:

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

  #### New Features:

  * [ ] I've added tests for the new feature
  * [ ] I've added docs for the new feature
  * [x] I've updated `CHANGELOG.md`

ACKs for top commit:
  afilini:
    ACK b5c8ce924bc47d26a0d577bfcbdaf241c56aa253

Tree-SHA512: d6a8c1ca2c13d3a84704592053cc450557c96229b0092e655ccf97775c3e0a23e9e1499cf8c9fc5a24fc0665ec0333d0ec6d6b06cb15eb2e14c033f06c3032c2

3 years agoBump version to 0.19.0-dev github/release/0.18.0
Steve Myers [Wed, 20 Apr 2022 17:31:31 +0000 (10:31 -0700)]
Bump version to 0.19.0-dev

3 years agoBump version to 0.18.0 v0.18.0
Steve Myers [Wed, 20 Apr 2022 16:58:13 +0000 (09:58 -0700)]
Bump version to 0.18.0

3 years agoAdd `n:` wrapper to vulnerable scripts
Alekos Filini [Wed, 20 Apr 2022 16:25:26 +0000 (18:25 +0200)]
Add `n:` wrapper to vulnerable scripts

3 years agoBump 'miniscript' dependency version to '^6.1'
Steve Myers [Wed, 20 Apr 2022 15:16:53 +0000 (08:16 -0700)]
Bump 'miniscript' dependency version to '^6.1'

3 years agoMerge bitcoindevkit/bdk#589: export: Rename `WalletExport` to `FullyNodedExport`
Steve Myers [Wed, 20 Apr 2022 02:19:25 +0000 (19:19 -0700)]
Merge bitcoindevkit/bdk#589: export: Rename `WalletExport` to `FullyNodedExport`

9ed36875f1112d884f6c3c2beab89faf8aa5d2e0 export: Rename `WalletExport` to `FullyNodedExport` (Alekos Filini)

Pull request description:

  ### Description

  The `WalletExport` type can still be used as an alias to `FullyNodedExport` but it has been marked as deprecated and will be removed in the next release.

  ### 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
  * [x] I've updated `CHANGELOG.md`

ACKs for top commit:
  bucko13:
    Concept ACK 9ed3687
  notmandatory:
    ACK 9ed36875f1112d884f6c3c2beab89faf8aa5d2e0

Tree-SHA512: fe07307092d3040b30ae96901d5fc4afecee635412bca4a0d2e78d90f07990e7bbcd6b87ed923bf5804385356f419cacadbfefbaf97ebc9a622e34548438ee00

3 years agoexport: Rename `WalletExport` to `FullyNodedExport`
Alekos Filini [Tue, 19 Apr 2022 09:44:50 +0000 (11:44 +0200)]
export: Rename `WalletExport` to `FullyNodedExport`

The `WalletExport` type can still be used as an alias to
`FullyNodedExport` but it has been marked as deprecated and will be
removed in the next release.

3 years agoMerge branch 'master' into release/0.18.0
Steve Myers [Thu, 14 Apr 2022 17:06:47 +0000 (10:06 -0700)]
Merge branch 'master' into release/0.18.0

3 years agoMerge bitcoindevkit/bdk#583: Improve keys traits, simplify `rpcwallet` example
Steve Myers [Thu, 14 Apr 2022 16:56:46 +0000 (09:56 -0700)]
Merge bitcoindevkit/bdk#583: Improve keys traits, simplify `rpcwallet` example

44758f9483b049acbcd9f8948e29cd6f6add0cc2 Simplify the `rpcwallet` example using the improved keys traits (Alekos Filini)
c350064dae43fd9c892bb7dd272b14ce62f9e82d Update changelog changes in `keys` mod (Alekos Filini)
92746440db964b5e50f4017828516b36eb14e765 [keys] Make `GenerateKey<K>` clonable if K is (Alekos Filini)
e4eb95fb9cfbae3596deb310984fa18462d1b30c [keys] Implement `DerivableKey<Ctx>` for `(GeneratedKey<Mnemonic, Ctx>, Option<String>)` (Alekos Filini)

Pull request description:

  ### Description

  I recently looked at the `rpcwallet` example and immediately thought the key generation part was very confusing. I made a few little changes to our traits and now I believe it's much better.

  I'm copying the next few paragraphs from the first commit in this PR which explains why it's better not to extract the key from the `GeneratedKey` wrapper:

  > This lets us use a tuple of (generated mnemonic, optional passphrase) as a `DerivableKey` directly, without extracting the inner mnemonic from the `GeneratedKey` wrapper. For BIP39 keys specifically it doesn't make much difference because the mnemonic format doesn't encode the network, but in general this is not the case and having a consistent API will make it harder for people to make mistakes.

  > To explain why we should not extract the key: some key formats (like BIP32 extended keys) are network-specific, meaning that if somebody tries to use a Testnet key on a Mainnet BDK wallet, it won't work.

  > However, when we generate a new key we would like to be able to use that key on any network, but we need to set some kind of placeholder for the `network` field in the structure. This is why (or at least one of the reasons why) we wrap the key in the `GeneratedKey` struct: we keep track of the "valid_networks" separately, which means that even if we set our BIP32 xprv to be a "Mainnet" key, once we go try creating a wallet with that key BDK is smart enough to understand that `GeneratedKey`s have  their own separate set of valid networks and it will use that set to validate whether the key can be used in the wallet or not.

  ### Notes to the reviewers

  I'm adding this to the `0.18` milestone even if the feature freeze is today. I don't think we should wait for this PR to start the release branch, but since it's just a minor addition to our traits I believe we could merge this afterwards to the release branch if we manage to get it reviewed and ready within the next week.

  Otherwise it'll just wait for `0.19`, it's not a big deal.

  ### 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
  * [x] I've updated `CHANGELOG.md`

ACKs for top commit:
  notmandatory:
    tACK 44758f9483b049acbcd9f8948e29cd6f6add0cc2

Tree-SHA512: 31a8b5a3cd56c7c39688c4804026a8b6cee950c50ea880efcddc150ef523e2ddcc544831bf996a58b5cf3b7bc4a086c1008dc0728604e5134d331c68855c2d5b

3 years agoUpdate changelog with addition of keychain to AddressInfo
Steve Myers [Wed, 13 Apr 2022 20:51:12 +0000 (13:51 -0700)]
Update changelog with addition of keychain to AddressInfo

3 years agoBump version to 0.18.0-rc.1
Steve Myers [Wed, 13 Apr 2022 20:40:16 +0000 (13:40 -0700)]
Bump version to 0.18.0-rc.1

3 years agoSimplify the `rpcwallet` example using the improved keys traits
Alekos Filini [Wed, 13 Apr 2022 10:56:43 +0000 (12:56 +0200)]
Simplify the `rpcwallet` example using the improved keys traits

3 years agoUpdate changelog changes in `keys` mod
Alekos Filini [Wed, 13 Apr 2022 10:55:58 +0000 (12:55 +0200)]
Update changelog changes in `keys` mod

3 years ago[keys] Make `GenerateKey<K>` clonable if K is
Alekos Filini [Wed, 13 Apr 2022 10:55:23 +0000 (12:55 +0200)]
[keys] Make `GenerateKey<K>` clonable if K is

3 years ago[keys] Implement `DerivableKey<Ctx>` for `(GeneratedKey<Mnemonic, Ctx>, Option<String>)`
Alekos Filini [Wed, 13 Apr 2022 10:37:27 +0000 (12:37 +0200)]
[keys] Implement `DerivableKey<Ctx>` for `(GeneratedKey<Mnemonic, Ctx>, Option<String>)`

This lets us use a tuple of (generated mnemonic, optional passphrase) as
a `DerivableKey` directly, without extracting the inner mnemonic from the
`GeneratedKey` wrapper. For BIP39 keys specifically it doesn't make much
difference because the mnemonic format doesn't encode the network, but in
general this is not the case and having a consistent API will make it
harder for people to make mistakes.

To explain why we should not extract the key: some key formats (like
BIP32 extended keys) are network-specific, meaning that if somebody
tries to use a Testnet key on a Mainnet BDK wallet, it won't work.

However, when we generate a new key we would like to be able to use that
key on any network, but we need to set some kind of placeholder for the
`network` field in the structure. This is why (or at least one of the
reasons why) we wrap the key in the `GeneratedKey` struct: we keep track
of the "valid_networks" separately, which means that even if we set our
BIP32 xprv to be a "Mainnet" key, once we go try creating a wallet with
that key BDK is smart enough to understand that `GeneratedKey`s have
their own separate set of valid networks and it will use that set to
validate whether the key can be used in the wallet or not.

3 years agoMerge bitcoindevkit/bdk#577: Deprecate Database::flush() function
Alekos Filini [Wed, 13 Apr 2022 10:00:23 +0000 (12:00 +0200)]
Merge bitcoindevkit/bdk#577: Deprecate Database::flush() function

a111d254769bfa698043cb9172a3e1cc84329ee4 Deprecate Database::flush() function (Steve Myers)

Pull request description:

  ### Description

  The Database::flush() function is only needed for the sled database on mobile, instead for mobile use the sqlite database.

  ### Notes to the reviewers

  This PR is in preparation for removing the Database::flush() function. See https://github.com/bitcoindevkit/bdk/pull/575#issuecomment-1082916667.

  After the `release/0.18.0` feature freeze branch is created then #575 should be merged.

  ### 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
  * [x] I've updated `CHANGELOG.md`

ACKs for top commit:
  afilini:
    ACK a111d254769bfa698043cb9172a3e1cc84329ee4

Tree-SHA512: 18434dc95dbef47118a0d4fface908bdf920a7ffcef927b36bb740c15f8efcf11dea9198b364648f16f74aaec4aa18e92a3c5e925299b2f3b9d69e566f89e790

3 years agoDeprecate Database::flush() function
Steve Myers [Sat, 2 Apr 2022 16:52:44 +0000 (09:52 -0700)]
Deprecate Database::flush() function

The Database::flush() function is only needed for the sled database on mobile, instead for mobile use the sqlite database.

3 years agoExpose bip39::Error
志宇 [Thu, 7 Apr 2022 11:38:46 +0000 (19:38 +0800)]
Expose bip39::Error

3 years agoMerge bitcoindevkit/bdk#579: Faster sync by collecting esplora ureq thread handles
Steve Myers [Wed, 6 Apr 2022 19:39:01 +0000 (12:39 -0700)]
Merge bitcoindevkit/bdk#579: Faster sync by collecting esplora ureq thread handles

adef166b22d5c95006df39fd8c57574624071189 Create vector of thread handles to spawn threads (nickfarrow)

Pull request description:

  ### Description
  Speeds up esplora ureq syncing. Taken from https://github.com/bitcoindevkit/bdk/pull/560

  The current sync just creates a map of scripts to joinhandles which doesn't yet spawn the sync threads due to lazy evaluation. In the following `handles.map()`, the thread handles are *sequentially* evaluated and joined. With the fix, the handles are collected so that the threads spawn in parallel, and then joined

  ### Notes to the reviewers

  I had to add a `#[allow(clippy::needless_collect)]` so that it wouldn't complain about collecting and then iterating. (Perhaps clippy is partially responsible for this issue!)

  Tested sync performance by doing a fresh sync on an existing [gun](https://gun.fun) wallet.
  ```
  ---- Before fix ---
  real0m13.121s
  real0m13.367s
  real0m13.211s

  ---- After fix ----
  real0m5.516s
  real0m5.251s
  real0m5.594s
  ```

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

ACKs for top commit:
  notmandatory:
    ACK adef166b22d5c95006df39fd8c57574624071189

Tree-SHA512: 47c617117afde9b4706bfa63759bf06d1ec60ff95d8a80931e5b7e40e3293c855d2f7dac0c681173d43aecf77201a842e739b82291da09ac81909cf526a51c8d

3 years agoCreate vector of thread handles to spawn threads
nickfarrow [Tue, 5 Apr 2022 02:11:52 +0000 (12:11 +1000)]
Create vector of thread handles to spawn threads

Signed-off-by: nickfarrow <nick@nickfarrow.com>
3 years agoMerge bitcoindevkit/bdk#562: Expose more getters in Wallet and other useful descripto...
Steve Myers [Tue, 5 Apr 2022 03:52:26 +0000 (20:52 -0700)]
Merge bitcoindevkit/bdk#562: Expose more getters in Wallet and other useful descriptor traits

1b9014846c5cb690f5c37f70556717b788a0733b Update changelog (Alekos Filini)
86abd8698f34d91f94bfce896affb535cca27146 [descriptor] Expose utilities to deal with derived descriptors (Alekos Filini)
0d9c2f76e00af801668fa2a70fcd13f9e399c0d2 [export] Use the new getters on `Wallet` to generate export JSONs (Alekos Filini)
63d5bcee934febe4d38622b677131bbe2e1a0abe [wallet] Add more getters (Alekos Filini)

Pull request description:

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

  ### Description

  Expose more getters and internal utilities for people who need to work with descriptors.

  A good example of how this can be leveraged is in the second commit, which refactors the wallet export functionality to use the new public APIs rather than using members on `Wallet` 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

  #### New Features:

  * [ ] I've added tests for the new feature
  * [x] I've added docs for the new feature
  * [x] I've updated `CHANGELOG.md`

ACKs for top commit:
  notmandatory:
    ACK 8cd055090d75669c67a44467cc0281465ef31270

Tree-SHA512: 3e8833670ebc56316fce01fc572fcc9391d602ef85f0cde8edcb446295570a9012e18f6ba8af0984153e4688f66f7eea6803ef610ceb395867e464e05c01c137

3 years agoMerge branch 'master' into feature/more-getters
Steve Myers [Tue, 5 Apr 2022 02:32:55 +0000 (19:32 -0700)]
Merge branch 'master' into feature/more-getters

3 years agoUpdate changelog
Alekos Filini [Wed, 9 Mar 2022 17:43:42 +0000 (18:43 +0100)]
Update changelog

3 years agoMerge bitcoindevkit/bdk#563: update AddressInfo struct
Steve Myers [Tue, 5 Apr 2022 00:35:31 +0000 (17:35 -0700)]
Merge bitcoindevkit/bdk#563: update AddressInfo struct

2698fc0219eb360e84a89ceabba4793777bf550b update AddressInfo struct (eunoia_1729)

Pull request description:

  ### Description

  Resolves #541.
  - Updates `AddressInfo` struct to include `keychainKind`
  - Updates the related `get_address` functions to pass in this field
  - Updates corresponding tests
  ### Checklists

  #### All Submissions:

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

Top commit has no ACKs.

Tree-SHA512: b1d22e5f322e1a35390fb06a5185457bd53af7c4a9c4e6e2fd5e93b967fa3f56af5848ac314e63e2b0becd60dbc8a4eeb761a2bdebfe8ba43ce49b13da4190b2

3 years agoupdate AddressInfo struct
eunoia_1729 [Thu, 10 Mar 2022 00:52:02 +0000 (06:22 +0530)]
update AddressInfo struct

3 years agoadd private function select_sorted_utxso to be resued by multiple CoinSelection impl
KaFai Choi [Tue, 8 Mar 2022 10:12:46 +0000 (17:12 +0700)]
add private function select_sorted_utxso to be resued by multiple CoinSelection impl

3 years agoadd OldestFirstCoinSelection
KaFai Choi [Sat, 26 Feb 2022 11:15:57 +0000 (18:15 +0700)]
add OldestFirstCoinSelection

3 years agoMerge bitcoindevkit/bdk#554: Fix hierarchy of headers on docs landing page
Steve Myers [Sat, 2 Apr 2022 02:32:23 +0000 (19:32 -0700)]
Merge bitcoindevkit/bdk#554: Fix hierarchy of headers on docs landing page

364ad95e85bd09a01cb4cbf3ceb9e9fcc074c8b4 Fix hierarchy of headers on docs landing page (thunderbiscuit)

Pull request description:

  ### Description

  This PR fixes the hierarchy of headers on the lib.rs docs. I noticed it as I was reading through the docs. The new hierarchy is the following:

  - About (h1)
  - A tour of BDK (h1)
  - Examples (h1)
    - Sync the balance of a descriptor (h2)
    - Generate a few addresses (h2)
    - Create a transaction (h2)
    - Sign a transaction (h2)
  - Feature flags (h1)
  - Internal features (h1)

  ### 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:
  rajarshimaitra:
    tACK https://github.com/bitcoindevkit/bdk/pull/554/commits/364ad95e85bd09a01cb4cbf3ceb9e9fcc074c8b4

Tree-SHA512: b4439a200c320a1815c572ac36b81c4d684209cb5cf1b90d3f761893ad672a270722be7d7b61d77434a7f98c4276d6fc9694d0c86cacf03c72dc35ca17b5e7d3

3 years agoMerge branch 'master', commit 'refs/pull/566/head' of github.com:bitcoindevkit/bdk
Steve Myers [Wed, 30 Mar 2022 16:54:34 +0000 (09:54 -0700)]
Merge branch 'master', commit 'refs/pull/566/head' of github.com:bitcoindevkit/bdk

3 years agoMerge bitcoindevkit/bdk#519: Add wallet creation example using RPC
Steve Myers [Tue, 29 Mar 2022 16:55:26 +0000 (09:55 -0700)]
Merge bitcoindevkit/bdk#519: Add wallet creation example using RPC

8a98e69e788dd79d030798465fbc0dec044d86f1 Add rpc wallet creation example (rajarshimaitra)

Pull request description:

  ### Description

  As mentioned in https://github.com/bitcoindevkit/bitcoindevkit.org/issues/83#issuecomment-1005190174 it would be helpful
  to have wallet creation example code in the `example` directory.

  This is an attempt to create the most simplistic bdk wallet with a RPC backend and demonstrate receiving, creating, signing
  and broadcasting transaction.

  The code is a refinement of the RPC tutorial https://bitcoindevkit.org/blog/bitcoin-core-rpc-demo/ with more elaborate doc comments.

  ### Notes to the reviewers

  To automate the background RPC process `electrsd` is used which is already a `dev-dependency` of bdk.

  ### 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:
    tACK 8a98e69e788dd79d030798465fbc0dec044d86f1

Tree-SHA512: f00c1ce57ef91c3d3ab2ce08af3571c41bbe98f18f705c61ba4217c2f8061196e5eaf6122742293cd6fa16939bbbfacd0f8506cd4151b55f19a05325fd94a74a

3 years ago[descriptor] Expose utilities to deal with derived descriptors
Alekos Filini [Wed, 9 Mar 2022 17:39:58 +0000 (18:39 +0100)]
[descriptor] Expose utilities to deal with derived descriptors

3 years ago[export] Use the new getters on `Wallet` to generate export JSONs
Alekos Filini [Wed, 9 Mar 2022 17:39:28 +0000 (18:39 +0100)]
[export] Use the new getters on `Wallet` to generate export JSONs

3 years ago[wallet] Add more getters
Alekos Filini [Wed, 9 Mar 2022 17:38:11 +0000 (18:38 +0100)]
[wallet] Add more getters

3 years agoAdd rpc wallet creation example
rajarshimaitra [Tue, 22 Mar 2022 06:55:39 +0000 (12:25 +0530)]
Add rpc wallet creation example

This adds an example wallet creation code with sled DB and RPC
Blockchain.

The backend RPC is managed using electrsd::bitcoind

3 years agoAdd sqlite-bundled feature
Steve Myers [Sat, 12 Mar 2022 01:44:31 +0000 (19:44 -0600)]
Add sqlite-bundled feature

3 years agoMerge commit 'refs/pull/564/head' of github.com:bitcoindevkit/bdk
Steve Myers [Mon, 21 Mar 2022 14:58:01 +0000 (09:58 -0500)]
Merge commit 'refs/pull/564/head' of github.com:bitcoindevkit/bdk

3 years agoBump version to 0.17.1-dev github/release/0.17.0
Steve Myers [Fri, 18 Mar 2022 14:35:46 +0000 (09:35 -0500)]
Bump version to 0.17.1-dev

3 years agoBump version to 0.17.0 v0.17.0
Steve Myers [Thu, 17 Mar 2022 16:17:55 +0000 (11:17 -0500)]
Bump version to 0.17.0

3 years agoMerge bitcoindevkit/bdk#545: Update `electrsd` to v0.15
Steve Myers [Thu, 17 Mar 2022 15:49:25 +0000 (10:49 -0500)]
Merge bitcoindevkit/bdk#545: Update `electrsd` to v0.15

1803f5ea8a7a2f8f9ebdfa520baad91f84bd6ba0 Update `electrsd` to v0.15 (Alekos Filini)

Pull request description:

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

  ### Description

  PR RCasatta/electrsd#33 has been merged and the new changes released as part of `v0.15.0`: the PR allows setting an env variable (`ELECTRSD_EXE`) to use a custom electrsd binary, which can be useful when the one that is downloaded automatically doesn't work for whatever reason.

  ### 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
  * [ ] I've updated `CHANGELOG.md`

  #### 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:
  LLFourn:
    ACK 1803f5e
  notmandatory:
    ACK 1803f5ea8a7a2f8f9ebdfa520baad91f84bd6ba0

Tree-SHA512: 01d84763a5acf3aa1686b91ba7cb0c7ec3a0ca6c7b9bac29aa74a72f54ed31c476b7a8b0f8c6c8a8ccf530ad8a19e90e144ac4cacbe436699ef9e319b5732f1c

3 years agoFix pre-segwit inputs with esplora
LLFourn [Tue, 15 Mar 2022 23:11:31 +0000 (10:11 +1100)]
Fix pre-segwit inputs with esplora

3 years agoMerge bitcoindevkit/bdk#571: Fix pre-segwit inputs with esplora
Steve Myers [Thu, 17 Mar 2022 15:05:36 +0000 (10:05 -0500)]
Merge bitcoindevkit/bdk#571: Fix pre-segwit inputs with esplora

52bc63e48f5d16cb03c8a58f7b0bd07cbb058dde Fix pre-segwit inputs with esplora (LLFourn)

Pull request description:

  Unexpectedly pre-segwit inputs have an empty JSON witness field in esplora.

  Fixes #570

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

ACKs for top commit:
  notmandatory:
    ACK 52bc63e48f5d16cb03c8a58f7b0bd07cbb058dde
  afilini:
    ACK 52bc63e48f5d16cb03c8a58f7b0bd07cbb058dde

Tree-SHA512: 1da82aeb2739111e1a516d94c79fe7d7c7879526a8cd780dcd63ff5ae9ccb1bed4eb20e5c575a45e37b6d1818d63ce6d3812e7b9ae34ebb02bc190a47b9750f8