Use my own fork of rust-miniscript

It supports multipath descriptors. We'll need to find a solution for the release
This commit is contained in:
Antoine Poinsot 2022-10-20 18:33:09 +02:00
parent 790d283e77
commit 3105b86a28
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304
3 changed files with 16 additions and 6 deletions

3
Cargo.lock generated
View File

@ -256,8 +256,7 @@ dependencies = [
[[package]]
name = "miniscript"
version = "8.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f4975078076f0b7b914a3044ad7432d2a7fcec38edb855afdc672e24ca35b69"
source = "git+https://github.com/darosior/rust-miniscript?branch=multipath_descriptors_on_8.0#7d756f2ab066d85d299f711f953ebda15f14e832"
dependencies = [
"bitcoin",
"serde",

View File

@ -25,7 +25,8 @@ jsonrpc_server = []
[dependencies]
# For managing transactions (it re-exports the bitcoin crate)
miniscript = { version = "8.0", features = ["serde"] }
# TODO: don't use my fork for a real release..
miniscript = { git = "https://github.com/darosior/rust-miniscript", branch = "multipath_descriptors_on_8.0", features = ["serde"] }
# Don't reinvent the wheel
dirs = "3.0"

View File

@ -125,6 +125,10 @@ impl MiniscriptKey for DerivedPublicKey {
fn is_x_only_key(&self) -> bool {
false
}
fn num_der_paths(&self) -> usize {
0
}
}
impl ToPublicKey for DerivedPublicKey {
@ -164,7 +168,8 @@ fn csv_check(csv_value: u32) -> Result<(), DescCreationError> {
fn is_unhardened_deriv(key: &descriptor::DescriptorPublicKey) -> bool {
match *key {
descriptor::DescriptorPublicKey::Single(..) => false,
descriptor::DescriptorPublicKey::Single(..)
| descriptor::DescriptorPublicKey::MultiXPub(..) => false,
descriptor::DescriptorPublicKey::XPub(ref xpub) => {
xpub.wildcard == descriptor::Wildcard::Unhardened
}
@ -342,10 +347,15 @@ impl InheritanceDescriptor {
&mut self,
pk: &descriptor::DescriptorPublicKey,
) -> Result<DerivedPublicKey, descriptor::ConversionError> {
let definite_key = pk.clone().at_derivation_index(self.0);
let definite_key = pk
.clone()
.at_derivation_index(self.0)
.expect("We disallow multipath keys.");
let origin = (
definite_key.master_fingerprint(),
definite_key.full_derivation_path(),
definite_key
.full_derivation_path()
.expect("We disallow multipath keys."),
);
let key = definite_key.derive_public_key(self.1)?;
Ok(DerivedPublicKey { origin, key })