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:
@@ -234,9 +234,9 @@ class MiningTest(BitcoinTestFramework):
|
||||
assert_raises_rpc_error(-25, 'time-too-old', lambda: node.submitheader(hexdata=CBlockHeader(bad_block_time).serialize().hex()))
|
||||
|
||||
# Should ask for the block from a p2p node, if they announce the header as well:
|
||||
node.add_p2p_connection(P2PDataStore())
|
||||
node.p2p.wait_for_getheaders(timeout=5) # Drop the first getheaders
|
||||
node.p2p.send_blocks_and_test(blocks=[block], node=node)
|
||||
peer = node.add_p2p_connection(P2PDataStore())
|
||||
peer.wait_for_getheaders(timeout=5) # Drop the first getheaders
|
||||
peer.send_blocks_and_test(blocks=[block], node=node)
|
||||
# Must be active now:
|
||||
assert chain_tip(block.hash, status='active', branchlen=0) in node.getchaintips()
|
||||
|
||||
|
Reference in New Issue
Block a user