Skip to content

[BUG] OP_CODESEPARATOR handling #178

@sander2

Description

@sander2

When running the command below, you can observe that the code separate position does not get correctly set by OP_CODESEPARATOR - it just always gets set to 0. I believe this is because opcode_pos does not correctly get incremented.

Run this:

btcdeb --txin=020000000001010b6ad48b306c6cc97e2850b4f84f35f4373a2bdf8abf17f46aa47947ba7827620000000000fdffffff0273ed052a010000002251205c25084d7b295ec36f1b81f4f7ceb0671a2d15429a8cf101ad454644208a53e7e803000000000000225120c61c497e749d1d077c04eabf8cb78764ced26358589251012e01a65bab8deae5024730440220602e8f9f2a86d648c2aa6e4683a55d14a0b7fed7bccacaf1e16d073d89977a9b022025e26e4e05309621cd8fe50ca6f11d0f1a85c9f33d24eb76c1615d024ddc585d01210368b179525abdc1f2256dce937648896a2d0ff3ab5aa6dde4a45c3da852d39b7cd4000000 --tx=020000000001012698ef5758d7a01cc33d76796b16ad233b21f09e6debec763ff6e599aae8e99e0100000000ffffffff02f0000000000000000451024e730000000000000000046a020b0b0540943facdf938ef6119593b0a1169d7a4016e44b936d20656c8ecc6afcbf023116f8d06076ef470f3e85bbcf9e4b00ccc443f697c9989e9cd8c6b25446285dc43640465e287935aa390004374fcd178c7cb200b2ac365f2aad3883e1f3b7610d72611ea1625b3a3cbec222aa750c0e2b693335374acb4a01a6f252aca6017eccdf5e407f3928d9b40f28f5f184f2771a84bff2d785f6c8f6da4b61c3b864b302344d03b19cecd017832647c9831d8af622d5b7c9f67662f474f9d75dfaee8699b2406228200f1809d1759b1da4384e0c34c5aa41a21638c95d504b5699ffb9203e107358c37dadab7dadabac21c050929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac000000000 --debug=sighash

Then repeat step instruction multiple times. You'll see the

 << code separator position
#004 00000000

Note: this is for a taproot script, which I believe has different OP_CODESEPARATOR rules than a normal segwit script.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions