MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / bootstrap_p2p

Method bootstrap_p2p

test/functional/feature_block.py:1294–1305  ·  view source on GitHub ↗

Add a P2P connection to the node. Helper to connect and wait for version handshake.

(self)

Source from the content-addressed store, hash-verified

1292 return block
1293
1294 def bootstrap_p2p(self):
1295 """Add a P2P connection to the node.
1296
1297 Helper to connect and wait for version handshake."""
1298 self.nodes[0].add_p2p_connection(P2PDataStore())
1299 # We need to wait for the initial getheaders from the peer before we
1300 # start populating our blockstore. If we don't, then we may run ahead
1301 # to the next subtest before we receive the getheaders. We'd then send
1302 # an INV for the next block and receive two getheaders - one for the
1303 # IBD and one for the INV. We'd respond to both and could get
1304 # unexpectedly disconnected if the DoS score for that error is 50.
1305 self.nodes[0].p2p.wait_for_getheaders(timeout=5)
1306
1307 def reconnect_p2p(self):
1308 """Tear down and bootstrap the P2P connection to the node.

Callers 2

run_testMethod · 0.95
reconnect_p2pMethod · 0.95

Calls 3

P2PDataStoreClass · 0.90
add_p2p_connectionMethod · 0.80
wait_for_getheadersMethod · 0.80

Tested by

no test coverage detected