mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-03 15:02:30 +02:00
scripted-diff: Use generate* from TestFramework
-BEGIN VERIFY SCRIPT- sed --regexp-extended -i \ 's/((self\.)?(nodes\[[^]]+\]|[a-z_]*(wallet|node)[0-9a-z_]*))\.(generate(|toaddress|block|todescriptor)(\(|, ))/self.\5\1, /g' \ $(git grep -l generate ./test | grep -v 'test_framework/' | grep -v 'feature_rbf') -END VERIFY SCRIPT-
This commit is contained in:
@@ -205,7 +205,7 @@ class SendHeadersTest(BitcoinTestFramework):
|
||||
|
||||
# Clear out block announcements from each p2p listener
|
||||
[x.clear_block_announcements() for x in self.nodes[0].p2ps]
|
||||
self.nodes[0].generatetoaddress(count, self.nodes[0].get_deterministic_priv_key().address)
|
||||
self.generatetoaddress(self.nodes[0], count, self.nodes[0].get_deterministic_priv_key().address)
|
||||
return int(self.nodes[0].getbestblockhash(), 16)
|
||||
|
||||
def mine_reorg(self, length):
|
||||
@@ -216,7 +216,7 @@ class SendHeadersTest(BitcoinTestFramework):
|
||||
return the list of block hashes newly mined."""
|
||||
|
||||
# make sure all invalidated blocks are node0's
|
||||
self.nodes[0].generatetoaddress(length, self.nodes[0].get_deterministic_priv_key().address)
|
||||
self.generatetoaddress(self.nodes[0], length, self.nodes[0].get_deterministic_priv_key().address)
|
||||
self.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))
|
||||
@@ -225,7 +225,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].generatetoaddress(length + 1, self.nodes[1].get_deterministic_priv_key().address) # Must be longer than the orig chain
|
||||
all_hashes = self.generatetoaddress(self.nodes[1], length + 1, self.nodes[1].get_deterministic_priv_key().address) # Must be longer than the orig chain
|
||||
self.sync_blocks(self.nodes, wait=0.1)
|
||||
return [int(x, 16) for x in all_hashes]
|
||||
|
||||
@@ -240,7 +240,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].generatetoaddress(1, self.nodes[0].get_deterministic_priv_key().address)[0])
|
||||
tip = self.nodes[0].getblockheader(self.generatetoaddress(self.nodes[0], 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