Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/blocktools.py
Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | def create_coinbase(height, pubkey=None): | ||||
return coinbase | return coinbase | ||||
# Create a transaction. | # Create a transaction. | ||||
# If the scriptPubKey is not specified, make it anyone-can-spend. | # If the scriptPubKey is not specified, make it anyone-can-spend. | ||||
def create_transaction(prevtx, n, sig, value, scriptPubKey=CScript()): | def create_transaction(prevtx, n, sig, value, scriptPubKey=CScript()): | ||||
tx = CTransaction() | tx = CTransaction() | ||||
assert(n < len(prevtx.vout)) | assert n < len(prevtx.vout) | ||||
tx.vin.append(CTxIn(COutPoint(prevtx.sha256, n), sig, 0xffffffff)) | tx.vin.append(CTxIn(COutPoint(prevtx.sha256, n), sig, 0xffffffff)) | ||||
tx.vout.append(CTxOut(value, scriptPubKey)) | tx.vout.append(CTxOut(value, scriptPubKey)) | ||||
pad_tx(tx) | pad_tx(tx) | ||||
tx.calc_sha256() | tx.calc_sha256() | ||||
return tx | return tx | ||||
def get_legacy_sigopcount_block(block, fAccurate=True): | def get_legacy_sigopcount_block(block, fAccurate=True): | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | for i in range(iterations): | ||||
ctx.vout[1].nValue -= fee + 1 | ctx.vout[1].nValue -= fee + 1 | ||||
signed_tx = node.signrawtransactionwithwallet(ToHex(ctx))["hex"] | signed_tx = node.signrawtransactionwithwallet(ToHex(ctx))["hex"] | ||||
node.sendrawtransaction(signed_tx) | node.sendrawtransaction(signed_tx) | ||||
while (node.getmempoolinfo()['size'] > 0): | while (node.getmempoolinfo()['size'] > 0): | ||||
node.generate(1) | node.generate(1) | ||||
utxos = node.listunspent() | utxos = node.listunspent() | ||||
assert(len(utxos) >= count) | assert len(utxos) >= count | ||||
return utxos | return utxos | ||||
def mine_big_block(node, utxos=None): | def mine_big_block(node, utxos=None): | ||||
# generate a 66k transaction, | # generate a 66k transaction, | ||||
# and 14 of them is close to the 1MB block limit | # and 14 of them is close to the 1MB block limit | ||||
num = 14 | num = 14 | ||||
utxos = utxos if utxos is not None else [] | utxos = utxos if utxos is not None else [] | ||||
Show All 31 Lines |