mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-03 11:53:16 +02:00
Changed functional tests which do not require wallets to run without
skipping .Addreses #14216. Changed get_deterministic_priv_key() to a named tuple
This commit is contained in:
@@ -208,15 +208,12 @@ class SendHeadersTest(BitcoinTestFramework):
|
||||
self.setup_clean_chain = True
|
||||
self.num_nodes = 2
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def mine_blocks(self, count):
|
||||
"""Mine count blocks and return the new tip."""
|
||||
|
||||
# Clear out block announcements from each p2p listener
|
||||
[x.clear_block_announcements() for x in self.nodes[0].p2ps]
|
||||
self.nodes[0].generate(count)
|
||||
self.nodes[0].generatetoaddress(count, self.nodes[0].get_deterministic_priv_key().address)
|
||||
return int(self.nodes[0].getbestblockhash(), 16)
|
||||
|
||||
def mine_reorg(self, length):
|
||||
@@ -226,7 +223,8 @@ class SendHeadersTest(BitcoinTestFramework):
|
||||
to-be-reorged-out blocks are mined, so that we don't break later tests.
|
||||
return the list of block hashes newly mined."""
|
||||
|
||||
self.nodes[0].generate(length) # make sure all invalidated blocks are node0's
|
||||
# make sure all invalidated blocks are node0's
|
||||
self.nodes[0].generatetoaddress(length, self.nodes[0].get_deterministic_priv_key().address)
|
||||
sync_blocks(self.nodes, wait=0.1)
|
||||
for x in self.nodes[0].p2ps:
|
||||
x.wait_for_block_announcement(int(self.nodes[0].getbestblockhash(), 16))
|
||||
@@ -235,7 +233,7 @@ class SendHeadersTest(BitcoinTestFramework):
|
||||
tip_height = self.nodes[1].getblockcount()
|
||||
hash_to_invalidate = self.nodes[1].getblockhash(tip_height - (length - 1))
|
||||
self.nodes[1].invalidateblock(hash_to_invalidate)
|
||||
all_hashes = self.nodes[1].generate(length + 1) # Must be longer than the orig chain
|
||||
all_hashes = self.nodes[1].generatetoaddress(length + 1, self.nodes[1].get_deterministic_priv_key().address) # Must be longer than the orig chain
|
||||
sync_blocks(self.nodes, wait=0.1)
|
||||
return [int(x, 16) for x in all_hashes]
|
||||
|
||||
@@ -254,7 +252,7 @@ class SendHeadersTest(BitcoinTestFramework):
|
||||
self.test_nonnull_locators(test_node, inv_node)
|
||||
|
||||
def test_null_locators(self, test_node, inv_node):
|
||||
tip = self.nodes[0].getblockheader(self.nodes[0].generate(1)[0])
|
||||
tip = self.nodes[0].getblockheader(self.nodes[0].generatetoaddress(1, self.nodes[0].get_deterministic_priv_key().address)[0])
|
||||
tip_hash = int(tip["hash"], 16)
|
||||
|
||||
inv_node.check_last_inv_announcement(inv=[tip_hash])
|
||||
|
Reference in New Issue
Block a user