aboutsummaryrefslogtreecommitdiff
path: root/qa/rpc-tests/util.py
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-11-21 13:48:07 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2014-11-21 13:48:41 +0100
commit37c47e18098f678a543d3a0a62e31092c757cb9d (patch)
tree608032d3c6f1b92393768415fa7b4df8bb1175ca /qa/rpc-tests/util.py
parent9c3572b0ab2e941fee04a9f323293abc219c0634 (diff)
parente4ef72449349a011110b23e5e26ce2c083801fb0 (diff)
downloadbitcoin-37c47e18098f678a543d3a0a62e31092c757cb9d.tar.xz
Merge pull request #5333
e4ef724 Edited rpc-tests to run python script not shell script. (mrbandrews) 189fb52 Port of wallet.sh to python (wallet.py). (mrbandrews)
Diffstat (limited to 'qa/rpc-tests/util.py')
-rw-r--r--qa/rpc-tests/util.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/qa/rpc-tests/util.py b/qa/rpc-tests/util.py
index c6d918a81c..bed7fed8ca 100644
--- a/qa/rpc-tests/util.py
+++ b/qa/rpc-tests/util.py
@@ -57,7 +57,6 @@ def sync_mempools(rpc_connections):
if num_match == len(rpc_connections):
break
time.sleep(1)
-
bitcoind_processes = {}
@@ -130,6 +129,15 @@ def initialize_chain(test_dir):
shutil.copytree(from_dir, to_dir)
initialize_datadir(test_dir, i) # Overwrite port/rpcport in bitcoin.conf
+def initialize_chain_clean(test_dir, num_nodes):
+ """
+ Create an empty blockchain and num_nodes wallets.
+ Useful if a test case wants complete control over initialization.
+ """
+ for i in range(num_nodes):
+ datadir=initialize_datadir(test_dir, i)
+
+
def _rpchost_to_args(rpchost):
'''Convert optional IP:port spec to rpcconnect/rpcport args'''
if rpchost is None:
@@ -221,11 +229,13 @@ def find_output(node, txid, amount):
return i
raise RuntimeError("find_output txid %s : %s not found"%(txid,str(amount)))
-def gather_inputs(from_node, amount_needed):
+
+def gather_inputs(from_node, amount_needed, confirmations_required=1):
"""
Return a random set of unspent txouts that are enough to pay amount_needed
"""
- utxo = from_node.listunspent(1)
+ assert(confirmations_required >=0)
+ utxo = from_node.listunspent(confirmations_required)
random.shuffle(utxo)
inputs = []
total_in = Decimal("0.00000000")