@ -177,17 +177,17 @@ def default_negflag(ctx):
""" Default expression for " negflag " : tap.negflag. """
""" Default expression for " negflag " : tap.negflag. """
return get ( ctx , " tap " ) . negflag
return get ( ctx , " tap " ) . negflag
def default_pubkey_in ner ( ctx ) :
def default_pubkey_in ternal ( ctx ) :
""" Default expression for " pubkey_in ner" : tap.inner _pubkey."""
""" Default expression for " pubkey_in ternal" : tap.internal _pubkey."""
return get ( ctx , " tap " ) . in ner _pubkey
return get ( ctx , " tap " ) . in ternal _pubkey
def default_merklebranch ( ctx ) :
def default_merklebranch ( ctx ) :
""" Default expression for " merklebranch " : tapleaf.merklebranch. """
""" Default expression for " merklebranch " : tapleaf.merklebranch. """
return get ( ctx , " tapleaf " ) . merklebranch
return get ( ctx , " tapleaf " ) . merklebranch
def default_controlblock ( ctx ) :
def default_controlblock ( ctx ) :
""" Default expression for " controlblock " : combine leafversion, negflag, pubkey_in ner , merklebranch."""
""" Default expression for " controlblock " : combine leafversion, negflag, pubkey_in ternal , merklebranch."""
return bytes ( [ get ( ctx , " leafversion " ) + get ( ctx , " negflag " ) ] ) + get ( ctx , " pubkey_in ner " ) + get ( ctx , " merklebranch " )
return bytes ( [ get ( ctx , " leafversion " ) + get ( ctx , " negflag " ) ] ) + get ( ctx , " pubkey_in ternal " ) + get ( ctx , " merklebranch " )
def default_sighash ( ctx ) :
def default_sighash ( ctx ) :
""" Default expression for " sighash " : depending on mode, compute BIP341, BIP143, or legacy sighash. """
""" Default expression for " sighash " : depending on mode, compute BIP341, BIP143, or legacy sighash. """
@ -341,9 +341,9 @@ DEFAULT_CONTEXT = {
" tapleaf " : default_tapleaf ,
" tapleaf " : default_tapleaf ,
# The script to push, and include in the sighash, for a taproot script path spend.
# The script to push, and include in the sighash, for a taproot script path spend.
" script_taproot " : default_script_taproot ,
" script_taproot " : default_script_taproot ,
# The in ner pubkey for a taproot script path spend (32 bytes).
# The in ternal pubkey for a taproot script path spend (32 bytes).
" pubkey_in ner" : default_pubkey_inner ,
" pubkey_in ternal" : default_pubkey_internal ,
# The negation flag of the in ner pubkey for a taproot script path spend.
# The negation flag of the in ternal pubkey for a taproot script path spend.
" negflag " : default_negflag ,
" negflag " : default_negflag ,
# The leaf version to include in the sighash (this does not affect the one in the control block).
# The leaf version to include in the sighash (this does not affect the one in the control block).
" leafversion " : default_leafversion ,
" leafversion " : default_leafversion ,
@ -780,8 +780,8 @@ def spenders_taproot_active():
add_spender ( spenders , " spendpath/negflag " , tap = tap , leaf = " 128deep " , * * SINGLE_SIG , key = secs [ 0 ] , failure = { " negflag " : lambda ctx : 1 - default_negflag ( ctx ) } , * * ERR_WITNESS_PROGRAM_MISMATCH )
add_spender ( spenders , " spendpath/negflag " , tap = tap , leaf = " 128deep " , * * SINGLE_SIG , key = secs [ 0 ] , failure = { " negflag " : lambda ctx : 1 - default_negflag ( ctx ) } , * * ERR_WITNESS_PROGRAM_MISMATCH )
# Test that bitflips in the Merkle branch invalidate it.
# Test that bitflips in the Merkle branch invalidate it.
add_spender ( spenders , " spendpath/bitflipmerkle " , tap = tap , leaf = " 128deep " , * * SINGLE_SIG , key = secs [ 0 ] , failure = { " merklebranch " : bitflipper ( default_merklebranch ) } , * * ERR_WITNESS_PROGRAM_MISMATCH )
add_spender ( spenders , " spendpath/bitflipmerkle " , tap = tap , leaf = " 128deep " , * * SINGLE_SIG , key = secs [ 0 ] , failure = { " merklebranch " : bitflipper ( default_merklebranch ) } , * * ERR_WITNESS_PROGRAM_MISMATCH )
# Test that bitflips in the in ner pubkey invalidate it.
# Test that bitflips in the in ternal pubkey invalidate it.
add_spender ( spenders , " spendpath/bitflippubkey " , tap = tap , leaf = " 128deep " , * * SINGLE_SIG , key = secs [ 0 ] , failure = { " pubkey_in ner" : bitflipper ( default_pubkey_inner ) } , * * ERR_WITNESS_PROGRAM_MISMATCH )
add_spender ( spenders , " spendpath/bitflippubkey " , tap = tap , leaf = " 128deep " , * * SINGLE_SIG , key = secs [ 0 ] , failure = { " pubkey_in ternal" : bitflipper ( default_pubkey_internal ) } , * * ERR_WITNESS_PROGRAM_MISMATCH )
# Test that empty witnesses are invalid.
# Test that empty witnesses are invalid.
add_spender ( spenders , " spendpath/emptywit " , tap = tap , leaf = " 128deep " , * * SINGLE_SIG , key = secs [ 0 ] , failure = { " witness " : [ ] } , * * ERR_EMPTY_WITNESS )
add_spender ( spenders , " spendpath/emptywit " , tap = tap , leaf = " 128deep " , * * SINGLE_SIG , key = secs [ 0 ] , failure = { " witness " : [ ] } , * * ERR_EMPTY_WITNESS )
# Test that adding garbage to the control block invalidates it.
# Test that adding garbage to the control block invalidates it.