aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2016-05-03 13:12:35 +0200
committerMarcoFalke <falke.marco@gmail.com>2016-05-03 13:13:25 +0200
commit88b77c7da0a672c89e24df37ea6e9085b4e2a05c (patch)
tree2aaab7cae82572ef072e8c6a805577a1d6d01be9
parent03cf6e86750218f633498210923544f4a6c3c020 (diff)
parent43bbcd075355630544a530f3cc52014edb3787b2 (diff)
Merge #7980: [qa] smartfees: Properly use ordered dict
43bbcd0 [qa] Fix typos in doc and comments (Pavel Janík) fa17f93 [qa] smartfees: Properly use ordered dict (MarcoFalke)
-rwxr-xr-xqa/rpc-tests/smartfees.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/qa/rpc-tests/smartfees.py b/qa/rpc-tests/smartfees.py
index 2c064ad8a0..7239e5a0da 100755
--- a/qa/rpc-tests/smartfees.py
+++ b/qa/rpc-tests/smartfees.py
@@ -7,6 +7,7 @@
# Test fee estimation code
#
+from collections import OrderedDict
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
@@ -22,7 +23,7 @@ SCRIPT_SIG = ["0451025175", "0451025275"]
def small_txpuzzle_randfee(from_node, conflist, unconflist, amount, min_fee, fee_increment):
'''
Create and send a transaction with a random fee.
- The transaction pays to a trival P2SH script, and assumes that its inputs
+ The transaction pays to a trivial P2SH script, and assumes that its inputs
are of the same form.
The function takes a list of confirmed outputs and unconfirmed outputs
and attempts to use the confirmed list first for its inputs.
@@ -49,10 +50,10 @@ def small_txpuzzle_randfee(from_node, conflist, unconflist, amount, min_fee, fee
if total_in <= amount + fee:
raise RuntimeError("Insufficient funds: need %d, have %d"%(amount+fee, total_in))
outputs = {}
- outputs[P2SH_1] = total_in - amount - fee
- outputs[P2SH_2] = amount
+ outputs = OrderedDict([(P2SH_1, total_in - amount - fee),
+ (P2SH_2, amount)])
rawtx = from_node.createrawtransaction(inputs, outputs)
- # Createrawtransaction constructions a transaction that is ready to be signed
+ # createrawtransaction constructs a transaction that is ready to be signed.
# These transactions don't need to be signed, but we still have to insert the ScriptSig
# that will satisfy the ScriptPubKey.
completetx = rawtx[0:10]
@@ -78,12 +79,10 @@ def split_inputs(from_node, txins, txouts, initial_split = False):
'''
prevtxout = txins.pop()
inputs = []
- outputs = {}
inputs.append({ "txid" : prevtxout["txid"], "vout" : prevtxout["vout"] })
half_change = satoshi_round(prevtxout["amount"]/2)
rem_change = prevtxout["amount"] - half_change - Decimal("0.00001000")
- outputs[P2SH_1] = half_change
- outputs[P2SH_2] = rem_change
+ outputs = OrderedDict([(P2SH_1, half_change), (P2SH_2, rem_change)])
rawtx = from_node.createrawtransaction(inputs, outputs)
# If this is the initial split we actually need to sign the transaction
# Otherwise we just need to insert the property ScriptSig
@@ -224,7 +223,7 @@ class EstimateFeeTest(BitcoinTestFramework):
sync_mempools(self.nodes[0:3],.1)
mined = mining_node.getblock(mining_node.generate(1)[0],True)["tx"]
sync_blocks(self.nodes[0:3],.1)
- #update which txouts are confirmed
+ # update which txouts are confirmed
newmem = []
for utx in self.memutxo:
if utx["txid"] in mined: