mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-10-11 03:53:22 +02:00
[refactor] clarify tests by referencing p2p objects directly
Use object returned from add_p2p_connection to refer to p2ps. Add a test class attribute if it needs to be used across many methods. Don't use the p2p property.
This commit is contained in:
@@ -61,7 +61,7 @@ class VersionBitsWarningTest(BitcoinTestFramework):
|
||||
|
||||
def run_test(self):
|
||||
node = self.nodes[0]
|
||||
node.add_p2p_connection(P2PInterface())
|
||||
peer = node.add_p2p_connection(P2PInterface())
|
||||
|
||||
node_deterministic_address = node.get_deterministic_priv_key().address
|
||||
# Mine one period worth of blocks
|
||||
@@ -69,7 +69,7 @@ class VersionBitsWarningTest(BitcoinTestFramework):
|
||||
|
||||
self.log.info("Check that there is no warning if previous VB_BLOCKS have <VB_THRESHOLD blocks with unknown versionbits version.")
|
||||
# Build one period of blocks with < VB_THRESHOLD blocks signaling some unknown bit
|
||||
self.send_blocks_with_version(node.p2p, VB_THRESHOLD - 1, VB_UNKNOWN_VERSION)
|
||||
self.send_blocks_with_version(peer, VB_THRESHOLD - 1, VB_UNKNOWN_VERSION)
|
||||
node.generatetoaddress(VB_PERIOD - VB_THRESHOLD + 1, node_deterministic_address)
|
||||
|
||||
# Check that we're not getting any versionbit-related errors in get*info()
|
||||
@@ -77,7 +77,7 @@ class VersionBitsWarningTest(BitcoinTestFramework):
|
||||
assert not VB_PATTERN.match(node.getnetworkinfo()["warnings"])
|
||||
|
||||
# Build one period of blocks with VB_THRESHOLD blocks signaling some unknown bit
|
||||
self.send_blocks_with_version(node.p2p, VB_THRESHOLD, VB_UNKNOWN_VERSION)
|
||||
self.send_blocks_with_version(peer, VB_THRESHOLD, VB_UNKNOWN_VERSION)
|
||||
node.generatetoaddress(VB_PERIOD - VB_THRESHOLD, node_deterministic_address)
|
||||
|
||||
self.log.info("Check that there is a warning if previous VB_BLOCKS have >=VB_THRESHOLD blocks with unknown versionbits version.")
|
||||
|
Reference in New Issue
Block a user