62 Commits

Author SHA1 Message Date
LLFourn
aab2b12f7a
bdk_core integration initial commit 🔥
We prepare the BDK repo for a major restructuring.

- database modules removed
- blockchain module removed
- minimal API changes.
- Many macros removed.
- no longer applicable examples removed.
- Much conditional compilation removed. Can compile with --all-features.
- delete verify module
2023-03-02 10:55:07 +01:00
Jeremy Mawson
14bc9c0e35
[#344] Add assert_matches
Replace assert!(matches! with assert_matches! everywhere
Convert assert! to assert_eq! in 2 places
2022-12-23 22:05:53 +10:00
Alekos Filini
150f4d6f41
fix: ensure the key network is updated in the KeyMap as well
Otherwise we may have inconsistencies with keys in the descriptor that
have a network and keys in the keymap that are different.
2022-11-23 17:58:47 +01:00
Steve Myers
9cb6f70fc0
Merge branch 'master' into fix_wallet_checksum 2022-10-26 22:01:07 -05:00
Alekos Filini
c7a43d941f
Remove unused code 2022-10-25 12:14:36 +02:00
Alekos Filini
1ffd59d469
Upgrade to rust-bitcoin 0.29 2022-10-25 11:16:02 +02:00
Steve Myers
60057a7bf7
Deprecate backward compatible get_checksum_bytes, get_checksum functions
Rename replacement functions calc_checksum_bytes and calc_checksum
2022-10-24 14:24:54 -05:00
志宇
e2a4a5884b
Ensure backward compatibility of the "checksum inception" bug
`Wallet` stores the descriptors' checksum in the database for safety.
Previously, the checksum used was a checksum of a descriptor that
already had a checksum.

This PR allows for backward-compatibility of databases created with this
bug.
2022-09-29 14:45:24 +08:00
志宇
fd34956c29
get_checksum_bytes now checks input data for checksum
If `exclude_hash` is set, we split the input data, and if a checksum
already existed within the original data, we check the calculated
checksum against the original checksum.

Additionally, the implementation of `IntoWalletDescriptor` for `&str`
has been refactored for clarity.
2022-09-29 13:06:03 +08:00
Alekos Filini
e2bf9734b1
Remove redundant duplicated keys check
This check is redundant since it's already performed by miniscript (see
https://docs.rs/miniscript/7.0.0/miniscript/miniscript/analyzable/enum.AnalysisError.html#variant.RepeatedPubkeys)
and it was incorrectly failing on tr descriptors that contain duplicated
keys across different taproot leaves

Fixes #760
2022-09-24 15:42:42 +02:00
Buck Perley
a85ef62698
fix typo 2022-06-05 14:19:37 -05:00
Alekos Filini
c121dd0252
Use tap_key_origins in PSBTs to derive descriptors 2022-05-31 18:16:17 +02:00
Alekos Filini
8a5a87b075
Populate tap_key_origin in PSBT inputs and outputs 2022-05-31 18:06:59 +02:00
Alekos Filini
82de8b50da
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
2022-05-23 21:02:42 +02:00
Alekos Filini
a16c18255c
Upgrade to rust-bitcoin 0.28 and miniscript 7.0 2022-05-12 12:51:21 +02:00
Alekos Filini
86abd8698f
[descriptor] Expose utilities to deal with derived descriptors 2022-03-25 11:18:56 +01:00
Gianluca Acerbis
b6fe01c466
Implement XKeyUtils on InnerXKey
Closes #395
2022-02-12 17:14:07 +01:00
thunderbiscuit
7f8103dd76
Fix typos in comments 2021-11-23 14:09:54 -05:00
thunderbiscuit
b9fc06195b
Fix typo in check_miniscript method declaration and use 2021-11-23 13:25:24 -05:00
Tobin Harding
12de13b95c
Remove redundant borrows
Clippy emits:

  warning: this expression borrows a reference

As suggested remove the borrows from the front of vars that are already references.
2021-06-10 13:16:07 +10:00
Riccardo Casatta
8f422a1bf9
Add timelocks to policy satisfaction results
Also for signature the logic has been refactored to handle appropriately nested cases.
2021-04-15 15:57:35 +02:00
Riccardo Casatta
192965413c
Convert upper-case acronyms as suggested by CamelCase convention
see https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms
2021-04-07 22:14:54 +02:00
Steve Myers
12ae1c3479
Update license to Apache 2.0 or MIT, copyright to Bitcoin Dev Kit Developers 2021-03-03 13:23:25 -08:00
Alekos Filini
4c2042ab01
[descriptor] Ensure that there are no duplicated keys 2021-02-26 09:46:38 +01:00
Alekos Filini
7843732e17
[descriptor] Perform additional checks before using a descriptor
Fixes #287
2021-02-17 12:08:31 -08:00
Steve Myers
1c6864aee8
Rename ToDescriptorKey to IntoDescriptorKey 2021-02-12 23:23:20 -08:00
Steve Myers
d638da2f10
Rename ToWalletDescriptor to IntoWalletDescriptor 2021-02-12 23:23:20 -08:00
Steve Myers
04348d0090
Fix clippy warning 'wrong_self_convention' 2021-02-12 22:23:48 -08:00
Alekos Filini
3d9d6fee07
Update bitcoin, miniscript, electrum-client 2021-02-05 09:11:27 -05:00
Alekos Filini
bf04a2cf69
descriptor: Use DescriptorError instead of Error when reasonable
Change the return type of the `descriptor!()` macro and `ToWalletDescriptor` to
avoid having to map errors.

Also introduce more checks to validate descriptors built using the macro.
2021-01-12 12:21:22 +01:00
Alekos Filini
7e90657ee1
[descriptor] Make the syntax of descriptor!() more consistent
The syntax now is pretty much the same as the normal descriptor syntax,
with the only difference that modifiers cannot be grouped together (i.e.
`sdv:older(144)` must be turned into `s:d:v:older(144)`.
2020-12-16 19:00:55 +01:00
Alekos Filini
c83cec3777
Merge commit 'refs/pull/221/head' of github.com:bitcoindevkit/bdk 2020-12-14 11:27:51 +01:00
Steve Myers
0f2dc05c08
[docs] Add docs to the 'descriptor' module 2020-12-13 20:57:28 -08:00
Steve Myers
60e5cf1f8a
[docs] Add docs to the 'policy' module 2020-12-13 20:40:23 -08:00
Alekos Filini
c0a92bd084
[keys] Replace (Fingerprint, DerivationPath) with KeySource 2020-12-11 11:16:41 +01:00
Alekos Filini
9bafdfe2d4
[docs] Various fixes to the docs 2020-12-11 11:16:38 +01:00
Steve Myers
602ae3d63a
Add TODOs for missing_docs 2020-12-07 18:25:16 -08:00
Alekos Filini
ebfe5db0c3
[wallet] Add a flag to fill-in PSBT_GLOBAL_XPUB 2020-12-01 16:43:38 +01:00
LLFourn
d2490d9ce3
Fix to at least bitcoin ^0.25.2
And fix the fallout.
2020-11-23 15:06:13 +11:00
Justin Moon
b1b2f2abd6
[wallet] Don't wrap SignersContainer arguments in Arc 2020-11-19 10:27:33 -06:00
Alekos Filini
7a42c5e095
Switch to "mainline" rust-miniscript 2020-11-17 23:57:28 +01:00
Alekos Filini
100f0aaa0a
Bump rust-bitcoin to 0.25, fix Cargo dependencies
Closes #112, closes #113, closes #124
2020-10-13 10:39:48 +02:00
Steve Myers
aea9abff8a
[ci] Fix clippy warnings, enable clippy checks 2020-10-10 10:31:07 -07:00
Alekos Filini
1faf0ed0a0
Fix the recovery of a descriptor given a PSBT
This commit upgrades `rust-miniscript` with a fix to only return the prefix that
matches a `hd_keypath` instead of the full derivation path, and then adapts the
signer code accordingly.

This commit closes #108 and #109.
2020-10-02 17:52:11 +02:00
Steve Myers
eae15563d8
[descriptor] add ToWalletDescriptor trait tests 2020-09-25 22:21:11 -07:00
Alekos Filini
c93cd1414a
[descriptor] Add descriptor templates, add DerivableKey 2020-09-24 09:53:54 +02:00
Alekos Filini
c51ba4a99f
[keys] Add a way to restrict the networks in which keys are valid
Thanks to the `ToWalletDescriptor` trait we can also very easily validate the checksum
for descriptors that are loaded from strings, if they contain one. Fixes #20.
2020-09-24 09:53:51 +02:00
Alekos Filini
751a553925
[descriptor] Improve the descriptor macro, add traits for key and descriptor types 2020-09-24 09:53:42 +02:00
Alekos Filini
9832ecb660
[descriptor] Add a macro to write descriptors from code 2020-09-24 09:53:41 +02:00
Alekos Filini
7065c1fed6
Write more docs 2020-09-04 11:44:49 +02:00