rpc: decodescript fails for witness scripts with length larger than uint16 #29103

issue conduition opened this issue on December 18, 2023
  1. conduition commented at 12:09 AM on December 18, 2023: none

    Is there an existing issue for this?

    • I have searched the existing issues

    Current behaviour

    Decoding scripts fails for large scripts with lengths greater than 0xFFFF. See this inscription transaction for an example which bitcoin core cannot decode.

    Expected behaviour

    Any script that can be included in a taproot witness should be decodable by bitcoin core.

    Steps to reproduce

    $ bitcoin-cli decodescript $(bitcoin-cli getrawtransaction 36ef4b89daa22096575c08844823375753dc8be4e4890a30ac8defde1c1a9e7a  1 | jq -r '.vin[0].txinwitness[1]')
    -bash: /usr/local/bin/bitcoin-cli: Argument list too long
    $ bitcoin-cli getrawtransaction 36ef4b89daa22096575c08844823375753dc8be4e4890a30ac8defde1c1a9e7a  1 | jq -r '.vin[0].txinwitness[1]' | xxd -r -p | wc -c
    196052
    

    I narrowed down the exact size limit.

    $ bitcoin-cli decodescript $(bitcoin-cli getrawtransaction 36ef4b89daa22096575c08844823375753dc8be4e4890a30ac8defde1c1a9e7a  1 | jq -r '.vin[0].txinwitness[1]' | head -c 131072
    -bash: /usr/local/bin/bitcoin-cli: Argument list too long
    $ bitcoin-cli decodescript $(bitcoin-cli getrawtransaction 36ef4b89daa22096575c08844823375753dc8be4e4890a30ac8defde1c1a9e7a  1 | jq -r '.vin[0].txinwitness[1]' | head -c 131070 )
    {
      "asm": "...",
      "desc": "...",
      "type": "nonstandard"
    }
    

    Relevant log output

    No response

    How did you obtain Bitcoin Core

    Pre-built binaries

    What version of Bitcoin Core are you using?

    v26.0.0

    Operating system and version

    Linux

    Machine specifications

    N/A

  2. sipa commented at 12:21 AM on December 18, 2023: member

    This is a limitation of your shell (bash), not Bitcoin Core.

    You can use the -stdin argument to bitcoin-cli to pass it arguments that don't fit on the command line of your system.

  3. conduition commented at 12:22 AM on December 18, 2023: none

    Ah my apologies. I misunderstood the error.

  4. conduition closed this on Dec 18, 2023

  5. bitcoin locked this on Dec 17, 2024

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-22 21:13 UTC

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