INNER CODE UNIT · Python
witness
BlockstreamResearch/secp256k1-zkp · tools/tests_silentpayments_generate.py:50
witness = witness[item_len+1:]
# Check for script-path spend with NUMS_H
if len(witness_stack) > 1 and witness_stack[-1][0] == 0x50:
witness_stack.pop()
if len(witness_stack) > 1: # script-path spend?
control_block = witness_stack[-1]
internal_key = control_block[1:33]
if internal_key == NUMS_H: # skip
return b''
# Convert to x-only (32 bytes) for taproot
if len(pubkey) == 33:
pubkey = pubkey[1:] # Remove prefix byte
return pubkey
else: # regular input - use full compressed pubkey (33 bytes)
return pubkey