Why do I get "Invalid Taproot control block size" when spending a P2TR script path?

I'm building a Taproot script-path spend in Python (using bitcoin-utils or custom serialization helpers) and testmempoolaccept keeps rejecting with Invalid Taproot control block size. (The exact wrapper varies—sometimes non-mandatory-script-verify-flag, etc.)

Checked everything: tapleaf hash , Merkle path , hash count matches the tree. Preimage/script look fine. So I'm pretty sure the content of the control block is ok.

What I'm doing now:

control_block = [
    leaf_version,
    internal_pubkey,
    merkle_hash_1,
    merkle_hash_2
]

control_block_bytes = ser_string(b''.join(control_block))  # compactSize prefix

witness_stack = [
    preimage_or_sig,
    script,
    control_block_bytes
]

Tried splitting the control block into separate stack elements too (leaf_version, internal_key, hash1, hash2...) — that gave bad-witness-nonstandard instead.

What does "Invalid Taproot control block size" actually mean here? Am I serializing the control block wrong?



from Recent Questions - Bitcoin Stack Exchange https://ift.tt/bzVeF4S
via IFTTT

Popular posts from this blog

Crypto Exec Warns Tokenization Is Moving Faster Than Expected

Bitcoin Mining Could Be Strengthening The Ruble, Russian Central Bank Says

Nigerian SEC Partners With Police To Tackle Crypto Ponzi Schemes – Details