Skip to content

Commit fa17f93

Browse files
author
MarcoFalke
committed
[qa] smartfees: Properly use ordered dict
1 parent 0ad1041 commit fa17f93

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

qa/rpc-tests/smartfees.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# Test fee estimation code
88
#
99

10+
from collections import OrderedDict
1011
from test_framework.test_framework import BitcoinTestFramework
1112
from test_framework.util import *
1213

@@ -49,8 +50,8 @@ def small_txpuzzle_randfee(from_node, conflist, unconflist, amount, min_fee, fee
4950
if total_in <= amount + fee:
5051
raise RuntimeError("Insufficient funds: need %d, have %d"%(amount+fee, total_in))
5152
outputs = {}
52-
outputs[P2SH_1] = total_in - amount - fee
53-
outputs[P2SH_2] = amount
53+
outputs = OrderedDict([(P2SH_1, total_in - amount - fee),
54+
(P2SH_2, amount)])
5455
rawtx = from_node.createrawtransaction(inputs, outputs)
5556
# Createrawtransaction constructions a transaction that is ready to be signed
5657
# These transactions don't need to be signed, but we still have to insert the ScriptSig
@@ -78,12 +79,10 @@ def split_inputs(from_node, txins, txouts, initial_split = False):
7879
'''
7980
prevtxout = txins.pop()
8081
inputs = []
81-
outputs = {}
8282
inputs.append({ "txid" : prevtxout["txid"], "vout" : prevtxout["vout"] })
8383
half_change = satoshi_round(prevtxout["amount"]/2)
8484
rem_change = prevtxout["amount"] - half_change - Decimal("0.00001000")
85-
outputs[P2SH_1] = half_change
86-
outputs[P2SH_2] = rem_change
85+
outputs = OrderedDict([(P2SH_1, half_change), (P2SH_2, rem_change)])
8786
rawtx = from_node.createrawtransaction(inputs, outputs)
8887
# If this is the initial split we actually need to sign the transaction
8988
# Otherwise we just need to insert the property ScriptSig

0 commit comments

Comments
 (0)