diff options
author | MarcoFalke <falke.marco@gmail.com> | 2018-08-13 07:29:32 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2018-08-13 07:30:38 -0400 |
commit | b8eb0dfde4d4bd7285f309be87a5cb246e20f17f (patch) | |
tree | 66895282738efec46c98b4b9c1ce7d3ece46be13 /test/functional/test_framework | |
parent | a9c56b663439039b683f6ca2bcab12aab7c71366 (diff) | |
parent | cf9ed307e6efd2b63d54c74ca8bdd236028fd9dc (diff) |
Merge #13928: qa: blocktools enforce named args for amount
cf9ed307e6 qa: blocktools enforce named args for amount (MarcoFalke)
Pull request description:
Since #13669 changed some signatures, I think it might be worthwhile to enforce named args for primitive types such as amounts.
Tree-SHA512: 2733e7b6a20590b54bd54e81a09e3f5e2fadf4390bed594916b70729bcf485b048266012c1203369e0968032a2c6a2719107ac17ee925d8939af3df916eab1a6
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'] |