Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc-schnorr.py
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | |||||
# Blocks with invalid scripts give this error: | # Blocks with invalid scripts give this error: | ||||
BADINPUTS_ERROR = 'blk-bad-inputs' | BADINPUTS_ERROR = 'blk-bad-inputs' | ||||
# This 64-byte signature is used to test exclusion & banning according to | # This 64-byte signature is used to test exclusion & banning according to | ||||
# the above error messages. | # the above error messages. | ||||
# Tests of real 64 byte ECDSA signatures can be found in script_tests. | # Tests of real 64 byte ECDSA signatures can be found in script_tests. | ||||
sig64 = b'\0'*64 | sig64 = b'\0' * 64 | ||||
class SchnorrTest(BitcoinTestFramework): | class SchnorrTest(BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.num_nodes = 1 | self.num_nodes = 1 | ||||
self.block_heights = {} | self.block_heights = {} | ||||
▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
# Fund transaction | # Fund transaction | ||||
txfund = create_transaction(spendfrom, 0, b'', value, script) | txfund = create_transaction(spendfrom, 0, b'', value, script) | ||||
txfund.rehash() | txfund.rehash() | ||||
fundings.append(txfund) | fundings.append(txfund) | ||||
# Spend transaction | # Spend transaction | ||||
txspend = CTransaction() | txspend = CTransaction() | ||||
txspend.vout.append( | txspend.vout.append( | ||||
CTxOut(value-1000, CScript([OP_TRUE]))) | CTxOut(value - 1000, CScript([OP_TRUE]))) | ||||
txspend.vin.append( | txspend.vin.append( | ||||
CTxIn(COutPoint(txfund.sha256, 0), b'')) | CTxIn(COutPoint(txfund.sha256, 0), b'')) | ||||
# Sign the transaction | # Sign the transaction | ||||
sighashtype = SIGHASH_ALL | SIGHASH_FORKID | sighashtype = SIGHASH_ALL | SIGHASH_FORKID | ||||
hashbyte = bytes([sighashtype & 0xff]) | hashbyte = bytes([sighashtype & 0xff]) | ||||
sighash = SignatureHashForkId( | sighash = SignatureHashForkId( | ||||
script, txspend, 0, sighashtype, value) | script, txspend, 0, sighashtype, value) | ||||
▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines |