|
|
@ -22,6 +22,26 @@ from .authproxy import AuthServiceProxy, JSONRPCException
|
|
|
|
|
|
|
|
|
|
|
|
COVERAGE_DIR = None
|
|
|
|
COVERAGE_DIR = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Set Mocktime default to OFF.
|
|
|
|
|
|
|
|
#MOCKTIME is only needed for scripts that use the
|
|
|
|
|
|
|
|
#cached version of the blockchain. If the cached
|
|
|
|
|
|
|
|
#version of the blockchain is used without MOCKTIME
|
|
|
|
|
|
|
|
#then the mempools will not sync due to IBD.
|
|
|
|
|
|
|
|
MOCKTIME = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def enable_mocktime():
|
|
|
|
|
|
|
|
#For backwared compatibility of the python scripts
|
|
|
|
|
|
|
|
#with previous versions of the cache, set MOCKTIME
|
|
|
|
|
|
|
|
#to Jan 1, 2014 + (201 * 10 * 60)
|
|
|
|
|
|
|
|
global MOCKTIME
|
|
|
|
|
|
|
|
MOCKTIME = 1388534400 + (201 * 10 * 60)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def disable_mocktime():
|
|
|
|
|
|
|
|
global MOCKTIME
|
|
|
|
|
|
|
|
MOCKTIME = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_mocktime():
|
|
|
|
|
|
|
|
return MOCKTIME
|
|
|
|
|
|
|
|
|
|
|
|
def enable_coverage(dirname):
|
|
|
|
def enable_coverage(dirname):
|
|
|
|
"""Maintain a log of which RPC calls are made during testing."""
|
|
|
|
"""Maintain a log of which RPC calls are made during testing."""
|
|
|
@ -155,9 +175,10 @@ def initialize_chain(test_dir):
|
|
|
|
|
|
|
|
|
|
|
|
# Create a 200-block-long chain; each of the 4 nodes
|
|
|
|
# Create a 200-block-long chain; each of the 4 nodes
|
|
|
|
# gets 25 mature blocks and 25 immature.
|
|
|
|
# gets 25 mature blocks and 25 immature.
|
|
|
|
# blocks are created with timestamps 10 minutes apart, starting
|
|
|
|
# blocks are created with timestamps 10 minutes apart
|
|
|
|
# at 1 Jan 2014
|
|
|
|
# starting from 2010 minutes in the past
|
|
|
|
block_time = 1388534400
|
|
|
|
enable_mocktime()
|
|
|
|
|
|
|
|
block_time = get_mocktime() - (201 * 10 * 60)
|
|
|
|
for i in range(2):
|
|
|
|
for i in range(2):
|
|
|
|
for peer in range(4):
|
|
|
|
for peer in range(4):
|
|
|
|
for j in range(25):
|
|
|
|
for j in range(25):
|
|
|
@ -170,6 +191,7 @@ def initialize_chain(test_dir):
|
|
|
|
# Shut them down, and clean up cache directories:
|
|
|
|
# Shut them down, and clean up cache directories:
|
|
|
|
stop_nodes(rpcs)
|
|
|
|
stop_nodes(rpcs)
|
|
|
|
wait_bitcoinds()
|
|
|
|
wait_bitcoinds()
|
|
|
|
|
|
|
|
disable_mocktime()
|
|
|
|
for i in range(4):
|
|
|
|
for i in range(4):
|
|
|
|
os.remove(log_filename("cache", i, "debug.log"))
|
|
|
|
os.remove(log_filename("cache", i, "debug.log"))
|
|
|
|
os.remove(log_filename("cache", i, "db.log"))
|
|
|
|
os.remove(log_filename("cache", i, "db.log"))
|
|
|
@ -219,7 +241,7 @@ def start_node(i, dirname, extra_args=None, rpchost=None, timewait=None, binary=
|
|
|
|
if binary is None:
|
|
|
|
if binary is None:
|
|
|
|
binary = os.getenv("BITCOIND", "bitcoind")
|
|
|
|
binary = os.getenv("BITCOIND", "bitcoind")
|
|
|
|
# RPC tests still depend on free transactions
|
|
|
|
# RPC tests still depend on free transactions
|
|
|
|
args = [ binary, "-datadir="+datadir, "-server", "-keypool=1", "-discover=0", "-rest", "-blockprioritysize=50000" ]
|
|
|
|
args = [ binary, "-datadir="+datadir, "-server", "-keypool=1", "-discover=0", "-rest", "-blockprioritysize=50000", "-mocktime="+str(get_mocktime()) ]
|
|
|
|
if extra_args is not None: args.extend(extra_args)
|
|
|
|
if extra_args is not None: args.extend(extra_args)
|
|
|
|
bitcoind_processes[i] = subprocess.Popen(args)
|
|
|
|
bitcoind_processes[i] = subprocess.Popen(args)
|
|
|
|
devnull = open(os.devnull, "w")
|
|
|
|
devnull = open(os.devnull, "w")
|
|
|
|