Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_csv_activation.py
Show First 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | |||||
def send_generic_input_tx(node, coinbases, address): | def send_generic_input_tx(node, coinbases, address): | ||||
amount = Decimal("49.99") | amount = Decimal("49.99") | ||||
return node.sendrawtransaction(ToHex(sign_transaction(node, create_transaction(node, node.getblock(coinbases.pop())['tx'][0], address, amount)))) | return node.sendrawtransaction(ToHex(sign_transaction(node, create_transaction(node, node.getblock(coinbases.pop())['tx'][0], address, amount)))) | ||||
def create_bip68txs(node, bip68inputs, txversion, address, locktime_delta=0): | def create_bip68txs(node, bip68inputs, txversion, address, locktime_delta=0): | ||||
"""Returns a list of bip68 transactions with different bits set.""" | """Returns a list of bip68 transactions with different bits set.""" | ||||
txs = [] | txs = [] | ||||
assert(len(bip68inputs) >= 16) | assert len(bip68inputs) >= 16 | ||||
for i, (sdf, srhb, stf, srlb) in enumerate(product(*[[True, False]] * 4)): | for i, (sdf, srhb, stf, srlb) in enumerate(product(*[[True, False]] * 4)): | ||||
locktime = relative_locktime(sdf, srhb, stf, srlb) | locktime = relative_locktime(sdf, srhb, stf, srlb) | ||||
tx = create_transaction( | tx = create_transaction( | ||||
node, bip68inputs[i], address, Decimal("49.98")) | node, bip68inputs[i], address, Decimal("49.98")) | ||||
tx.nVersion = txversion | tx.nVersion = txversion | ||||
tx.vin[0].nSequence = locktime + locktime_delta | tx.vin[0].nSequence = locktime + locktime_delta | ||||
tx = sign_transaction(node, tx) | tx = sign_transaction(node, tx) | ||||
tx.rehash() | tx.rehash() | ||||
txs.append({'tx': tx, 'sdf': sdf, 'stf': stf}) | txs.append({'tx': tx, 'sdf': sdf, 'stf': stf}) | ||||
return txs | return txs | ||||
def create_bip112txs(node, bip112inputs, varyOP_CSV, txversion, address, locktime_delta=0): | def create_bip112txs(node, bip112inputs, varyOP_CSV, txversion, address, locktime_delta=0): | ||||
"""Returns a list of bip112 transactions with different bits set.""" | """Returns a list of bip112 transactions with different bits set.""" | ||||
txs = [] | txs = [] | ||||
assert(len(bip112inputs) >= 16) | assert len(bip112inputs) >= 16 | ||||
for i, (sdf, srhb, stf, srlb) in enumerate(product(*[[True, False]] * 4)): | for i, (sdf, srhb, stf, srlb) in enumerate(product(*[[True, False]] * 4)): | ||||
locktime = relative_locktime(sdf, srhb, stf, srlb) | locktime = relative_locktime(sdf, srhb, stf, srlb) | ||||
tx = create_transaction( | tx = create_transaction( | ||||
node, bip112inputs[i], address, Decimal("49.98")) | node, bip112inputs[i], address, Decimal("49.98")) | ||||
if (varyOP_CSV): # if varying OP_CSV, nSequence is fixed | if (varyOP_CSV): # if varying OP_CSV, nSequence is fixed | ||||
tx.vin[0].nSequence = BASE_RELATIVE_LOCKTIME + locktime_delta | tx.vin[0].nSequence = BASE_RELATIVE_LOCKTIME + locktime_delta | ||||
else: # vary nSequence instead, OP_CSV is fixed | else: # vary nSequence instead, OP_CSV is fixed | ||||
tx.vin[0].nSequence = locktime + locktime_delta | tx.vin[0].nSequence = locktime + locktime_delta | ||||
▲ Show 20 Lines • Show All 498 Lines • Show Last 20 Lines |