diff options
Diffstat (limited to 'qa/rpc-tests/test_framework/util.py')
-rw-r--r-- | qa/rpc-tests/test_framework/util.py | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/qa/rpc-tests/test_framework/util.py b/qa/rpc-tests/test_framework/util.py index 99c30f7651..85898d9f32 100644 --- a/qa/rpc-tests/test_framework/util.py +++ b/qa/rpc-tests/test_framework/util.py @@ -654,16 +654,15 @@ def create_tx(node, coinbase, to_address, amount): # Create a spend of each passed-in utxo, splicing in "txouts" to each raw # transaction to make it large. See gen_return_txouts() above. -def create_lots_of_big_transactions(node, txouts, utxos, fee): +def create_lots_of_big_transactions(node, txouts, utxos, num, fee): addr = node.getnewaddress() txids = [] - for i in range(len(utxos)): + for _ in range(num): t = utxos.pop() - inputs = [] - inputs.append({ "txid" : t["txid"], "vout" : t["vout"]}) + inputs=[{ "txid" : t["txid"], "vout" : t["vout"]}] outputs = {} - send_value = t['amount'] - fee - outputs[addr] = satoshi_round(send_value) + change = t['amount'] - fee + outputs[addr] = satoshi_round(change) rawtx = node.createrawtransaction(inputs, outputs) newtx = rawtx[0:92] newtx = newtx + txouts @@ -673,6 +672,19 @@ def create_lots_of_big_transactions(node, txouts, utxos, fee): txids.append(txid) return txids +def mine_large_block(node, utxos=None): + # generate a 66k transaction, + # and 14 of them is close to the 1MB block limit + num = 14 + txouts = gen_return_txouts() + utxos = utxos if utxos is not None else [] + if len(utxos) < num: + utxos.clear() + utxos.extend(node.listunspent()) + fee = 100 * node.getnetworkinfo()["relayfee"] + create_lots_of_big_transactions(node, txouts, utxos, num, fee=fee) + node.generate(1) + def get_bip9_status(node, key): info = node.getblockchaininfo() return info['bip9_softforks'][key] |