mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-05 18:52:29 +02:00
[tests] Move deterministic address import to setup_nodes
This requires a small changes to a few tests, but means that deterministic addresses will always be imported (unless setup_nodes behaviour is explicitly overridden).
This commit is contained in:
@@ -18,11 +18,6 @@ class ReceivedByTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 2
|
||||
|
||||
def import_deterministic_coinbase_privkeys(self):
|
||||
assert_equal(0, len(self.nodes[1].listreceivedbyaddress(minconf=0, include_empty=True, include_watchonly=True)))
|
||||
super().import_deterministic_coinbase_privkeys()
|
||||
self.num_cb_reward_addresses = len(self.nodes[1].listreceivedbyaddress(minconf=0, include_empty=True, include_watchonly=True))
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
@@ -31,6 +26,9 @@ class ReceivedByTest(BitcoinTestFramework):
|
||||
self.nodes[0].generate(1)
|
||||
sync_blocks(self.nodes)
|
||||
|
||||
# save the number of coinbase reward addresses so far
|
||||
num_cb_reward_addresses = len(self.nodes[1].listreceivedbyaddress(minconf=0, include_empty=True, include_watchonly=True))
|
||||
|
||||
self.log.info("listreceivedbyaddress Test")
|
||||
|
||||
# Send from node 0 to 1
|
||||
@@ -76,7 +74,7 @@ class ReceivedByTest(BitcoinTestFramework):
|
||||
assert_raises_rpc_error(-4, "address_filter parameter was invalid", self.nodes[1].listreceivedbyaddress, minconf=0, include_empty=True, include_watchonly=True, address_filter="bamboozling")
|
||||
# Another address receive money
|
||||
res = self.nodes[1].listreceivedbyaddress(0, True, True)
|
||||
assert_equal(len(res), 2 + self.num_cb_reward_addresses) # Right now 2 entries
|
||||
assert_equal(len(res), 2 + num_cb_reward_addresses) # Right now 2 entries
|
||||
other_addr = self.nodes[1].getnewaddress()
|
||||
txid2 = self.nodes[0].sendtoaddress(other_addr, 0.1)
|
||||
self.nodes[0].generate(1)
|
||||
@@ -93,7 +91,7 @@ class ReceivedByTest(BitcoinTestFramework):
|
||||
assert_equal(len(res), 1)
|
||||
# Should be two entries though without filter
|
||||
res = self.nodes[1].listreceivedbyaddress(0, True, True)
|
||||
assert_equal(len(res), 3 + self.num_cb_reward_addresses) # Became 3 entries
|
||||
assert_equal(len(res), 3 + num_cb_reward_addresses) # Became 3 entries
|
||||
|
||||
# Not on random addr
|
||||
other_addr = self.nodes[0].getnewaddress() # note on node[0]! just a random addr
|
||||
|
||||
Reference in New Issue
Block a user