rust-bitcoin / rust-miniscript

Support for Miniscript and Output Descriptors for rust-bitcoin
Creative Commons Zero v1.0 Universal
342 stars 135 forks source link

Getting error for `SortedMulti` while parsing descriptor #698

Open KnowWhoami opened 2 months ago

KnowWhoami commented 2 months ago

While parsing descriptor which uses SortedMulti function as shown ->


  let a=Descriptor::<DescriptorPublicKey>::parse_descriptor(&secp, "sortedmulti(2,03acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe,022f01e5e15cca351daff3843fb70f3c2f0a1bdd05e5af888a67784ef3e10a2a01)").unwrap();

I am getting this error->

  called `Result::unwrap()` on an `Err` value: Unexpected("sortedmulti(3 args) while parsing Miniscript")

After some search -> I found that this error is comming from

https://github.com/rust-bitcoin/rust-miniscript/blob/9e1b3cdf7e38563f4f2e7c2832a994f4c91a5e36/src/miniscript/astelem.rs#L317

apoelstra commented 2 months ago

sortedmulti needs to be wrapped in a top-level descriptor type like wsh.

And no, looks like we don't have sortedmulti_a support yet.

KnowWhoami commented 2 months ago

sortedmulti needs to be wrapped in a top-level descriptor type like wsh.

yeah , I previously was wrapping it with wsh -> but the function was returning the same value in Descriptor<DescriptorPublicKey>> type -> after taking off wsh function -> I noticed this error.