Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc-transaction-ordering.py
Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | def next_block(self, number, spend=None, tx_count=0): | ||||
spend = spendable_outputs.popleft() | spend = spendable_outputs.popleft() | ||||
tx.vin.append(CTxIn(COutPoint(spend.tx.sha256, spend.n))) | tx.vin.append(CTxIn(COutPoint(spend.tx.sha256, spend.n))) | ||||
# Add spendable outputs | # Add spendable outputs | ||||
for i in range(4): | for i in range(4): | ||||
tx.vout.append(CTxOut(0, CScript([OP_TRUE]))) | tx.vout.append(CTxOut(0, CScript([OP_TRUE]))) | ||||
spendable_outputs.append(PreviousSpendableOutput(tx, i)) | spendable_outputs.append(PreviousSpendableOutput(tx, i)) | ||||
# Put some random data into the transaction in order to randomize ids. | # Put some random data into the transaction in order to randomize ids. | ||||
# This also ensures that transaction are larger than 100 bytes. | # This also ensures that transaction are larger than 100 bytes. | ||||
tx.vout.append( | rand = random.getrandbits(256) | ||||
CTxOut(0, CScript([random.getrandbits(256), OP_RETURN]))) | tx.vout.append(CTxOut(0, CScript([rand, OP_RETURN]))) | ||||
return tx | return tx | ||||
tx = get_base_transaction() | tx = get_base_transaction() | ||||
# Make it the same format as transaction added for padding and save the size. | # Make it the same format as transaction added for padding and save the size. | ||||
# It's missing the padding output, so we add a constant to account for it. | # It's missing the padding output, so we add a constant to account for it. | ||||
tx.rehash() | tx.rehash() | ||||
▲ Show 20 Lines • Show All 159 Lines • Show Last 20 Lines |