WSH Descriptor throws `A function is required for P2WSH` #21926

issue i5hi opened this issue on May 12, 2021
  1. i5hi commented at 8:16 AM on May 12, 2021: none

    Using Bitcoin-Core 0.21.1

    We have a spending policy to allow one key to sign OR another key AND a timelock.

    or(pk(key_1),and(pk(key_2),after(15120)))

    eg. HD Public Key Format: key_1: [80c7402a/84h/1h/0h]tpubDDRf8pwB3k8Ew2ct7Z4AMfsh9GVcFSrE9e94yhQa6HhbZCCM1VuPKdBjeNvT1nbenStgmn2LovWFaFvKXeSonPk5eghpV5ouQvzYPiUNonP/*

    key_2:[5c959c83/84h/1h/0h]tpubDDJ5z8wZtrtqCujsnY6qZMNejmrvCoyaD62FQGdtruXA3RkUfdLfJnuyapVo8U4djhkJ22Bn3Y1vTbPxoALRLW9Hvwrh2nzWBSsHm8kJmR2/*

    Using miniscriptc and the HD Public Keys, we get the following decriptor:

    wsh(or_d(pk(key_1),and_v(v:pk(key_2),after(15120))))#fddcjzdh

    This appears to be valid on miniscriptc and it generates a receiving address.

    Expected behaviour

    Using importdescriptors with bitcoin-core should successfully import the descriptor and getnewaddress must return the same address as generated by miniscriptc.

    Actual behaviour

    When we pass this descriptor to getdescriptorinfo

    We get this errror:

    error code: -5
    error message:
    A function is needed within P2WSH
    

    We referenced https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md and the examples only show wsh and sh being used with pkh/wpkh , multi or sortedmulti - which I assumed are what get classified as 'functions'

    Maybe since we are using or_d here, which it is not a function but rather a comparison operator ?

    We have also referenced http://bitcoin.sipa.be/miniscript/ to build this policy.

  2. sipa commented at 1:24 PM on May 12, 2021: member

    Miniscript is not (yet) supported in Bitcoin Core.

  3. i5hi closed this on May 12, 2021

  4. DrahtBot locked this on Aug 18, 2022
Contributors

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-28 06:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me