mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-11 18:04:18 +00:00
Maintain trusted peers (#4159)
## Issue Addressed #4150 ## Proposed Changes Maintain trusted peers in the pruning logic. ~~In principle the changes here are not necessary as a trusted peer has a max score (100) and all other peers can have at most 0 (because we don't implement positive scores). This means that we should never prune trusted peers unless we have more trusted peers than the target peer count.~~ This change shifts this logic to explicitly never prune trusted peers which I expect is the intuitive behaviour. ~~I suspect the issue in #4150 arises when a trusted peer disconnects from us for one reason or another and then we remove that peer from our peerdb as it becomes stale. When it re-connects at some large time later, it is no longer a trusted peer.~~ Currently we do disconnect trusted peers, and this PR corrects this to maintain trusted peers in the pruning logic. As suggested in #4150 we maintain trusted peers in the db and thus we remember them even if they disconnect from us.
This commit is contained in:
@@ -50,7 +50,7 @@ impl TestRig {
|
||||
};
|
||||
let bl = BlockLookups::new(log.new(slog::o!("component" => "block_lookups")));
|
||||
let cx = {
|
||||
let globals = Arc::new(NetworkGlobals::new_test_globals(&log));
|
||||
let globals = Arc::new(NetworkGlobals::new_test_globals(Vec::new(), &log));
|
||||
SyncNetworkContext::new(
|
||||
network_tx,
|
||||
globals,
|
||||
|
||||
@@ -599,7 +599,7 @@ mod tests {
|
||||
log.new(o!("component" => "range")),
|
||||
);
|
||||
let (network_tx, network_rx) = mpsc::unbounded_channel();
|
||||
let globals = Arc::new(NetworkGlobals::new_test_globals(&log));
|
||||
let globals = Arc::new(NetworkGlobals::new_test_globals(Vec::new(), &log));
|
||||
let cx = SyncNetworkContext::new(
|
||||
network_tx,
|
||||
globals.clone(),
|
||||
|
||||
Reference in New Issue
Block a user