aboutsummaryrefslogtreecommitdiff
path: root/qa/rpc-tests/test_framework
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-03-16 17:32:02 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2016-03-16 17:32:05 +0100
commit3d0dfdbf9f26dcda6bc8a397752bdcc59ee474f4 (patch)
tree08fae04473f6760c6ac9cd84a61abf24d0bd6fed /qa/rpc-tests/test_framework
parenta6a860796a44a2805a58391a009ba22752f64e32 (diff)
parentfad8cfb893ac0ba83c6fc2367ade55bfe4fa75f6 (diff)
downloadbitcoin-3d0dfdbf9f26dcda6bc8a397752bdcc59ee474f4.tar.xz
Merge #7684: [qa] Extend tests
fad8cfb [qa] mininode: Add and use CONSTs (MarcoFalke) fa8cd46 [qa] Move create_tx() to util.py (MarcoFalke) fad7dc8 [qa] wallet: speed up tests (MarcoFalke) fa3a81a [tests] Extend util_ParseMoney test case (MarcoFalke)
Diffstat (limited to 'qa/rpc-tests/test_framework')
-rw-r--r--qa/rpc-tests/test_framework/blocktools.py2
-rwxr-xr-xqa/rpc-tests/test_framework/mininode.py6
-rw-r--r--qa/rpc-tests/test_framework/util.py8
3 files changed, 13 insertions, 3 deletions
diff --git a/qa/rpc-tests/test_framework/blocktools.py b/qa/rpc-tests/test_framework/blocktools.py
index 7eea41b75c..b075f69c47 100644
--- a/qa/rpc-tests/test_framework/blocktools.py
+++ b/qa/rpc-tests/test_framework/blocktools.py
@@ -45,7 +45,7 @@ def create_coinbase(height, pubkey = None):
coinbase.vin.append(CTxIn(COutPoint(0, 0xffffffff),
ser_string(serialize_script_num(height)), 0xffffffff))
coinbaseoutput = CTxOut()
- coinbaseoutput.nValue = 50*100000000
+ coinbaseoutput.nValue = 50 * COIN
halvings = int(height/150) # regtest
coinbaseoutput.nValue >>= halvings
if (pubkey != None):
diff --git a/qa/rpc-tests/test_framework/mininode.py b/qa/rpc-tests/test_framework/mininode.py
index 81bb439cea..934d0c7a75 100755
--- a/qa/rpc-tests/test_framework/mininode.py
+++ b/qa/rpc-tests/test_framework/mininode.py
@@ -38,6 +38,8 @@ MY_SUBVERSION = "/python-mininode-tester:0.0.1/"
MAX_INV_SZ = 50000
MAX_BLOCK_SIZE = 1000000
+COIN = 100000000L # 1 btc in satoshis
+
# Keep our own socket map for asyncore, so that we can track disconnects
# ourselves (to workaround an issue with closing an asyncore socket when
# using select)
@@ -377,7 +379,7 @@ class CTxOut(object):
def __repr__(self):
return "CTxOut(nValue=%i.%08i scriptPubKey=%s)" \
- % (self.nValue // 100000000, self.nValue % 100000000,
+ % (self.nValue // COIN, self.nValue % COIN,
binascii.hexlify(self.scriptPubKey))
@@ -426,7 +428,7 @@ class CTransaction(object):
def is_valid(self):
self.calc_sha256()
for tout in self.vout:
- if tout.nValue < 0 or tout.nValue > 21000000L * 100000000L:
+ if tout.nValue < 0 or tout.nValue > 21000000 * COIN:
return False
return True
diff --git a/qa/rpc-tests/test_framework/util.py b/qa/rpc-tests/test_framework/util.py
index 8c472a518d..ce3102988a 100644
--- a/qa/rpc-tests/test_framework/util.py
+++ b/qa/rpc-tests/test_framework/util.py
@@ -493,6 +493,14 @@ def gen_return_txouts():
txouts = txouts + script_pubkey
return txouts
+def create_tx(node, coinbase, to_address, amount):
+ inputs = [{ "txid" : coinbase, "vout" : 0}]
+ outputs = { to_address : amount }
+ rawtx = node.createrawtransaction(inputs, outputs)
+ signresult = node.signrawtransaction(rawtx)
+ assert_equal(signresult["complete"], True)
+ return signresult["hex"]
+
def create_lots_of_big_transactions(node, txouts, utxos, fee):
addr = node.getnewaddress()
txids = []