[qa] Add option --portseed to test_framework

This commit is contained in:
MarcoFalke
2016-05-09 19:55:49 +02:00
parent fa494dec79
commit ccccc591a4
3 changed files with 17 additions and 9 deletions

View File

@@ -8,7 +8,6 @@
# Helpful routines for regression testing
#
# Add python-bitcoinrpc to module search path:
import os
import sys
@@ -36,6 +35,11 @@ PORT_MIN = 11000
# The number of ports to "reserve" for p2p and rpc, each
PORT_RANGE = 5000
class PortSeed:
# Must be initialized with a unique integer for each process
n = None
#Set Mocktime default to OFF.
#MOCKTIME is only needed for scripts that use the
#cached version of the blockchain. If the cached
@@ -91,10 +95,10 @@ def get_rpc_proxy(url, node_number, timeout=None):
def p2p_port(n):
assert(n <= MAX_NODES)
return PORT_MIN + n + (MAX_NODES * os.getpid()) % (PORT_RANGE - 1 - MAX_NODES)
return PORT_MIN + n + (MAX_NODES * PortSeed.n) % (PORT_RANGE - 1 - MAX_NODES)
def rpc_port(n):
return PORT_MIN + PORT_RANGE + n + (MAX_NODES * os.getpid()) % (PORT_RANGE -1 - MAX_NODES)
return PORT_MIN + PORT_RANGE + n + (MAX_NODES * PortSeed.n) % (PORT_RANGE - 1 - MAX_NODES)
def check_json_precision():
"""Make sure json library being used does not lose precision converting BTC values"""