aboutsummaryrefslogtreecommitdiff
path: root/qa/rpc-tests
diff options
context:
space:
mode:
Diffstat (limited to 'qa/rpc-tests')
-rwxr-xr-xqa/rpc-tests/smartfees.py15
-rwxr-xr-xqa/rpc-tests/test_framework/mininode.py8
-rwxr-xr-xqa/rpc-tests/test_framework/test_framework.py2
-rw-r--r--qa/rpc-tests/test_framework/util.py2
4 files changed, 13 insertions, 14 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:
diff --git a/qa/rpc-tests/test_framework/mininode.py b/qa/rpc-tests/test_framework/mininode.py
index af33564114..30aecfd445 100755
--- a/qa/rpc-tests/test_framework/mininode.py
+++ b/qa/rpc-tests/test_framework/mininode.py
@@ -93,7 +93,7 @@ def deser_uint256(f):
def ser_uint256(u):
- rs = ""
+ rs = b""
for i in xrange(8):
rs += struct.pack("<I", u & 0xFFFFFFFFL)
u >>= 32
@@ -191,7 +191,7 @@ def deser_string_vector(f):
def ser_string_vector(l):
- r = ""
+ r = b""
if len(l) < 253:
r = struct.pack("B", len(l))
elif len(l) < 0x10000:
@@ -624,7 +624,7 @@ class CAlert(object):
self.vchSig = deser_string(f)
def serialize(self):
- r = ""
+ r = b""
r += ser_string(self.vchMsg)
r += ser_string(self.vchSig)
return r
@@ -988,7 +988,7 @@ class msg_reject(object):
def __init__(self):
self.message = b""
self.code = 0
- self.reason = ""
+ self.reason = b""
self.data = 0L
def deserialize(self, f):
diff --git a/qa/rpc-tests/test_framework/test_framework.py b/qa/rpc-tests/test_framework/test_framework.py
index 3b08cd1384..18ecf64b06 100755
--- a/qa/rpc-tests/test_framework/test_framework.py
+++ b/qa/rpc-tests/test_framework/test_framework.py
@@ -146,7 +146,7 @@ class BitcoinTestFramework(object):
print("key not found: "+ str(e))
traceback.print_tb(sys.exc_info()[2])
except Exception as e:
- print("Unexpected exception caught during testing: "+str(e))
+ print("Unexpected exception caught during testing: " + repr(e))
traceback.print_tb(sys.exc_info()[2])
if not self.options.noshutdown:
diff --git a/qa/rpc-tests/test_framework/util.py b/qa/rpc-tests/test_framework/util.py
index 27891f7f4c..baa1ed6790 100644
--- a/qa/rpc-tests/test_framework/util.py
+++ b/qa/rpc-tests/test_framework/util.py
@@ -487,7 +487,7 @@ def assert_array_result(object_array, to_match, expected, should_not_find = Fals
in object_array
"""
if should_not_find == True:
- expected = { }
+ assert_equal(expected, { })
num_matched = 0
for item in object_array:
all_match = True