Skip to content

Commit 7b1fec6

Browse files
authored
Implement peer factory and boot manager (#1286)
* Extract trinity code from p2p module * fix broken ActivationEvent * PR feedback
1 parent b871e64 commit 7b1fec6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1300
-859
lines changed

p2p/constants.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
# Timeout used when performing the check to ensure peers are on the same side of chain splits as
4141
# us.
42-
CHAIN_SPLIT_CHECK_TIMEOUT = 5 * REPLY_TIMEOUT
42+
CHAIN_SPLIT_CHECK_TIMEOUT = 15
4343

4444
# Default timeout before giving up on a caller-initiated interaction
4545
COMPLETION_TIMEOUT = 5
@@ -75,3 +75,8 @@
7575
# (https://github.com/ethereum/go-ethereum/pull/1889#issue-47241762), but in order to err on the
7676
# side of caution, we use a higher value.
7777
SEAL_CHECK_RANDOM_SAMPLE_RATE = 48
78+
79+
80+
# The amount of time that the BasePeerPool will wait for a peer to boot before
81+
# aborting the connection attempt.
82+
DEFAULT_PEER_BOOT_TIMEOUT = 20

p2p/discovery.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
from p2p.exceptions import AlreadyWaitingDiscoveryResponse, NoEligibleNodes, UnableToGetDiscV5Ticket
6060
from p2p import kademlia
6161
from p2p import protocol
62-
from p2p.peer import PeerPool
62+
from p2p.peer import BasePeerPool
6363
from p2p.service import BaseService
6464

6565
if TYPE_CHECKING:
@@ -948,7 +948,7 @@ class DiscoveryService(BaseService):
948948
_last_lookup: float = 0
949949
_lookup_interval: int = 30
950950

951-
def __init__(self, proto: DiscoveryProtocol, peer_pool: PeerPool,
951+
def __init__(self, proto: DiscoveryProtocol, peer_pool: BasePeerPool,
952952
port: int, token: CancelToken = None) -> None:
953953
super().__init__(token)
954954
self.proto = proto

0 commit comments

Comments
 (0)