diff options
author | MarcoFalke <falke.marco@gmail.com> | 2018-08-09 13:27:45 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2018-08-09 13:25:36 -0400 |
commit | cf9ed307e6efd2b63d54c74ca8bdd236028fd9dc (patch) | |
tree | e4654d7097141480a4d3f769e8edc64315d22062 /test/functional/test_framework | |
parent | f66e1c793eda7a6143fd03400c98512a9b6f00c7 (diff) |
qa: blocktools enforce named args for amount
Diffstat (limited to 'test/functional/test_framework')
-rw-r--r-- | test/functional/test_framework/blocktools.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/test/functional/test_framework/blocktools.py b/test/functional/test_framework/blocktools.py index 56f70d9833..987ade4044 100644 --- a/test/functional/test_framework/blocktools.py +++ b/test/functional/test_framework/blocktools.py @@ -118,7 +118,7 @@ def create_coinbase(height, pubkey=None): coinbase.calc_sha256() return coinbase -def create_tx_with_script(prevtx, n, script_sig=b"", amount=1, script_pub_key=CScript()): +def create_tx_with_script(prevtx, n, script_sig=b"", *, amount, script_pub_key=CScript()): """Return one-input, one-output transaction object spending the prevtx's n-th output with the given amount. @@ -131,26 +131,24 @@ def create_tx_with_script(prevtx, n, script_sig=b"", amount=1, script_pub_key=CS tx.calc_sha256() return tx -def create_transaction(node, txid, to_address, amount): +def create_transaction(node, txid, to_address, *, amount): """ Return signed transaction spending the first output of the input txid. Note that the node must be able to sign for the output that is being spent, and the node must not be running multiple wallets. """ - raw_tx = create_raw_transaction(node, txid, to_address, amount) + raw_tx = create_raw_transaction(node, txid, to_address, amount=amount) tx = CTransaction() tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx))) return tx -def create_raw_transaction(node, txid, to_address, amount): +def create_raw_transaction(node, txid, to_address, *, amount): """ Return raw signed transaction spending the first output of the input txid. Note that the node must be able to sign for the output that is being spent, and the node must not be running multiple wallets. """ - inputs = [{"txid": txid, "vout": 0}] - outputs = {to_address: amount} - rawtx = node.createrawtransaction(inputs, outputs) + rawtx = node.createrawtransaction(inputs=[{"txid": txid, "vout": 0}], outputs={to_address: amount}) signresult = node.signrawtransactionwithwallet(rawtx) assert_equal(signresult["complete"], True) return signresult['hex'] |