diff options
author | MarcoFalke <falke.marco@gmail.com> | 2016-10-01 18:44:54 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2016-12-02 16:32:00 +0100 |
commit | facbfa5816b5c947627f9c840169484605a5ca38 (patch) | |
tree | 275206718968d6aad879059233fde1a7a4fe35f4 /qa/rpc-tests/test_framework | |
parent | e22f409f18881b63a8e747036584a71217f40e6e (diff) | |
download | bitcoin-facbfa5816b5c947627f9c840169484605a5ca38.tar.xz |
[qa] Get rid of duplicate code
Diffstat (limited to 'qa/rpc-tests/test_framework')
-rw-r--r-- | qa/rpc-tests/test_framework/util.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/qa/rpc-tests/test_framework/util.py b/qa/rpc-tests/test_framework/util.py index 24a9d434af..2c428d1687 100644 --- a/qa/rpc-tests/test_framework/util.py +++ b/qa/rpc-tests/test_framework/util.py @@ -657,13 +657,12 @@ def create_tx(node, coinbase, to_address, amount): def create_lots_of_big_transactions(node, txouts, utxos, fee): addr = node.getnewaddress() txids = [] - for i in range(len(utxos)): + for _ in range(len(utxos)): 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,15 @@ def create_lots_of_big_transactions(node, txouts, utxos, fee): txids.append(txid) return txids +def mine_large_block(node): + # generate a 66k transaction, + # and 14 of them is close to the 1MB block limit + txouts = gen_return_txouts() + utxos = node.listunspent()[:14] + fee = 100 * node.getnetworkinfo()["relayfee"] + create_lots_of_big_transactions(node, txouts, utxos, fee=fee) + node.generate(1) + def get_bip9_status(node, key): info = node.getblockchaininfo() return info['bip9_softforks'][key] |