MCPcopy Create free account
hub / github.com/ElementsProject/elements / bootstrap_p2p

Method bootstrap_p2p

test/functional/feature_block.py:1452–1463  ·  view source on GitHub ↗

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

(self, timeout=10)

Source from the content-addressed store, hash-verified

1450 return block
1451
1452 def bootstrap_p2p(self, timeout=10):
1453 """Add a P2P connection to the node.
1454
1455 Helper to connect and wait for version handshake."""
1456 self.helper_peer = self.nodes[0].add_p2p_connection(P2PDataStore())
1457 # We need to wait for the initial getheaders from the peer before we
1458 # start populating our blockstore. If we don't, then we may run ahead
1459 # to the next subtest before we receive the getheaders. We'd then send
1460 # an INV for the next block and receive two getheaders - one for the
1461 # IBD and one for the INV. We'd respond to both and could get
1462 # unexpectedly disconnected if the DoS score for that error is 50.
1463 self.helper_peer.wait_for_getheaders(timeout=timeout)
1464
1465 def reconnect_p2p(self, timeout=60):
1466 """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.45
wait_for_getheadersMethod · 0.45

Tested by

no test coverage detected