Other fixes

This commit is contained in:
UdjinM6 2019-06-20 19:37:09 +03:00 committed by Pasta
parent 23114cdb20
commit f02bf18eec
No known key found for this signature in database
GPG Key ID: D362C9F7142766AE
11 changed files with 29 additions and 39 deletions

View File

@ -26,6 +26,8 @@ class DIP3Test(BitcoinTestFramework):
self.extra_args += ["-sporkkey=cP4EKFyJsHT39LDqgdcB43Y3YXjNyjb5Fuas1GQSeAtjnZWmZEQK"]
self.extra_args += ["-dip3params=135:150"]
def setup_network(self):
disable_mocktime()
self.start_controller_node()

View File

@ -13,18 +13,15 @@ class RawTransactionsTest(BitcoinTestFramework):
super().__init__()
self.setup_clean_chain = True
self.num_nodes = 4
self.extra_args = [['-usehd=1']] * self.num_nodes
def setup_network(self, split=False):
self.nodes = start_nodes(4, self.options.tmpdir, [['-usehd=1']] * self.num_nodes, stderr=sys.stdout)
def setup_network(self):
self.setup_nodes(stderr=sys.stdout)
connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2)
connect_nodes_bi(self.nodes,0,2)
connect_nodes_bi(self.nodes,0,3)
self.is_network_split=False
self.sync_all()
def run_test(self):
self.log.info("Mining blocks...")
@ -456,7 +453,6 @@ class RawTransactionsTest(BitcoinTestFramework):
connect_nodes_bi(self.nodes,1,2)
connect_nodes_bi(self.nodes,0,2)
connect_nodes_bi(self.nodes,0,3)
self.is_network_split=False
self.sync_all()
# drain the keypool

View File

@ -21,9 +21,10 @@ class RawTransactionsTest(BitcoinTestFramework):
super().__init__()
self.setup_clean_chain = True
self.num_nodes = 4
self.extra_args = [['-usehd=0']] * self.num_nodes
def setup_network(self, split=False):
self.setup_nodes([['-usehd=0']] * self.num_nodes)
self.setup_nodes()
connect_nodes_bi(self.nodes, 0, 1)
connect_nodes_bi(self.nodes, 1, 2)

View File

@ -23,7 +23,7 @@ class ListTransactionsTest(BitcoinTestFramework):
def setup_nodes(self):
#This test requires mocktime
enable_mocktime()
set_cache_mocktime()
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
def run_test(self):

View File

@ -95,7 +95,7 @@ class CompactBlocksTest(BitcoinTestFramework):
self.setup_clean_chain = True
# both nodes has the same version
self.num_nodes = 2
self.extra_args = [["-txindex"]]
self.extra_args = [["-txindex"]] * 2
self.utxos = []
def build_block_on_tip(self, node):

View File

@ -40,11 +40,6 @@ class P2PFingerprintTest(BitcoinTestFramework):
self.setup_clean_chain = True
self.num_nodes = 1
# TODO also remove this when bitcoin#11121 is backported
def setup_network(self, split=False):
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
self.is_network_split = False
# Build a chain of blocks on top of given one
def build_chain(self, nblocks, prev_hash, prev_height, prev_median_time):
blocks = []

View File

@ -14,7 +14,7 @@ class PrioritiseTransactionTest(BitcoinTestFramework):
super().__init__()
self.setup_clean_chain = True
self.num_nodes = 2
self.extra_args = [["-printpriority=1"] * 2]
self.extra_args = [["-printpriority=1"]] * 2
def run_test(self):
self.txouts = gen_return_txouts()

View File

@ -31,7 +31,7 @@ class ReceivedByTest(BitcoinTestFramework):
def setup_nodes(self):
#This test requires mocktime
enable_mocktime()
set_cache_mocktime()
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
def run_test(self):

View File

@ -17,25 +17,29 @@ import time
from concurrent.futures import ThreadPoolExecutor
from .util import (
assert_equal,
start_nodes,
PortSeed,
GENESISTIME,
MAX_NODES,
assert_equal,
bitcoind_processes,
check_json_precision,
connect_nodes_bi,
connect_nodes,
copy_datadir,
disable_mocktime,
disconnect_nodes,
enable_coverage,
enable_mocktime,
get_mocktime,
get_rpc_proxy,
initialize_datadir,
log_filename,
p2p_port,
rpc_url,
set_cache_mocktime,
set_genesis_mocktime,
set_mocktime,
set_node_times,
satoshi_round,
start_node,
start_nodes,
stop_node,
@ -44,15 +48,7 @@ from .util import (
sync_mempools,
sync_masternodes,
wait_for_bitcoind_start,
set_cache_mocktime,
set_genesis_mocktime,
get_mocktime,
set_mocktime,
set_node_times,
p2p_port,
satoshi_round,
wait_to_sync,
copy_datadir)
wait_to_sync)
from .authproxy import JSONRPCException
class BitcoinTestFramework(object):

View File

@ -25,7 +25,7 @@ class WalletAccountsTest(BitcoinTestFramework):
super().__init__()
self.setup_clean_chain = True
self.num_nodes = 1
self.extra_args = [[]]
self.extra_args = [["-paytxfee=0.0001"]]
def run_test(self):
node = self.nodes[0]
@ -33,7 +33,7 @@ class WalletAccountsTest(BitcoinTestFramework):
assert_equal(len(node.listunspent()), 0)
# Note each time we call generate, all generated coins go into
# the same address, so we call twice to get two addresses w/50 each
# the same address, so we call twice to get two addresses w/500 each
node.generate(1)
node.generate(101)
assert_equal(node.getbalance(), 1000)
@ -57,9 +57,11 @@ class WalletAccountsTest(BitcoinTestFramework):
common_address = "yd5KMREs3GLMe6mTJYr3YrH1juwNwrFCfB"
txid = node.sendmany(
fromaccount="",
amounts={common_address: 100},
subtractfeefrom=[common_address],
amounts={common_address: 1000},
minconf=1,
addlocked=False,
comment="",
subtractfeefrom=[common_address],
)
tx_details = node.gettransaction(txid)
fee = -tx_details['details'][0]['fee']

View File

@ -57,17 +57,15 @@ class WalletDumpTest(BitcoinTestFramework):
def __init__(self):
super().__init__()
self.setup_clean_chain = False
self.setup_clean_chain = True
self.num_nodes = 1
self.extra_args = [["-keypool=90", "-usehd=1"]]
def setup_chain(self):
def setup_network(self):
# TODO remove this when usehd=1 becomes the default
# use our own cache and -usehd=1 as extra arg as the default cache is run with -usehd=0
self._initialize_chain(os.path.join(self.options.tmpdir, "hd"), self.num_nodes, os.path.join(self.options.cachedir, "hd"), extra_args=self.extra_args[0], stderr=sys.stdout)
set_cache_mocktime()
def setup_network(self, split=False):
# Use 1 minute timeout because the initial getnewaddress RPC can take
# longer than the default 30 seconds due to an expensive
# CWallet::TopUpKeyPool call, and the encryptwallet RPC made later in
@ -75,7 +73,7 @@ class WalletDumpTest(BitcoinTestFramework):
self.nodes = start_nodes(self.num_nodes, os.path.join(self.options.tmpdir, "hd"), self.extra_args, timewait=60, stderr=sys.stdout)
def run_test (self):
tmpdir = self.options.tmpdir
tmpdir = os.path.join(self.options.tmpdir, "hd")
# generate 20 addresses to compare against the dump
test_addr_count = 20
@ -99,7 +97,7 @@ class WalletDumpTest(BitcoinTestFramework):
#encrypt wallet, restart, unlock and dump
self.nodes[0].encryptwallet('test')
bitcoind_processes[0].wait()
self.nodes[0] = start_node(0, self.options.tmpdir, self.extra_args[0])
self.nodes[0] = start_node(0, tmpdir, self.extra_args[0])
self.nodes[0].walletpassphrase('test', 10)
# Should be a no-op:
self.nodes[0].keypoolrefill()