Correct issue with dialing peers (#2375)

The ordering of adding new peers to the peerdb and deciding when to dial them was not considered in a previous update.

This adds the condition that if a peer is not in the peer-db then it is an acceptable peer to dial.

This makes #2374 obsolete.
This commit is contained in:
Age Manning 2021-05-29 07:25:06 +00:00
parent d12e746b50
commit ec5cceba50
2 changed files with 47 additions and 46 deletions

92
Cargo.lock generated
View File

@ -33,7 +33,7 @@ dependencies = [
"slog-term", "slog-term",
"slot_clock", "slot_clock",
"tempfile", "tempfile",
"tokio 1.6.0", "tokio 1.6.1",
"types", "types",
"validator_dir", "validator_dir",
] ]
@ -572,7 +572,7 @@ dependencies = [
"strum", "strum",
"task_executor", "task_executor",
"tempfile", "tempfile",
"tokio 1.6.0", "tokio 1.6.1",
"tree_hash", "tree_hash",
"types", "types",
] ]
@ -611,7 +611,7 @@ dependencies = [
"slog-term", "slog-term",
"store", "store",
"task_executor", "task_executor",
"tokio 1.6.0", "tokio 1.6.1",
"types", "types",
] ]
@ -802,7 +802,7 @@ dependencies = [
"slog-stdlog", "slog-stdlog",
"slog-term", "slog-term",
"sloggers", "sloggers",
"tokio 1.6.0", "tokio 1.6.1",
"types", "types",
] ]
@ -836,9 +836,9 @@ dependencies = [
[[package]] [[package]]
name = "bumpalo" name = "bumpalo"
version = "3.6.1" version = "3.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" checksum = "9c59e7af012c713f529e7a3ee57ce9b31ddd858d4b512923602f74608b009631"
[[package]] [[package]]
name = "byte-slice-cast" name = "byte-slice-cast"
@ -1065,7 +1065,7 @@ dependencies = [
"task_executor", "task_executor",
"time 0.2.26", "time 0.2.26",
"timer", "timer",
"tokio 1.6.0", "tokio 1.6.1",
"toml", "toml",
"tree_hash", "tree_hash",
"types", "types",
@ -1627,7 +1627,7 @@ dependencies = [
"rlp 0.5.0", "rlp 0.5.0",
"sha2 0.9.5", "sha2 0.9.5",
"smallvec", "smallvec",
"tokio 1.6.0", "tokio 1.6.1",
"tokio-stream", "tokio-stream",
"tokio-util 0.6.7", "tokio-util 0.6.7",
"tracing", "tracing",
@ -1812,7 +1812,7 @@ dependencies = [
"slog-term", "slog-term",
"sloggers", "sloggers",
"task_executor", "task_executor",
"tokio 1.6.0", "tokio 1.6.1",
"types", "types",
] ]
@ -1852,7 +1852,7 @@ dependencies = [
"sloggers", "sloggers",
"state_processing", "state_processing",
"task_executor", "task_executor",
"tokio 1.6.0", "tokio 1.6.1",
"tokio-compat-02", "tokio-compat-02",
"toml", "toml",
"tree_hash", "tree_hash",
@ -1867,7 +1867,7 @@ dependencies = [
"deposit_contract", "deposit_contract",
"futures 0.3.15", "futures 0.3.15",
"serde_json", "serde_json",
"tokio 1.6.0", "tokio 1.6.1",
"tokio-compat-02", "tokio-compat-02",
"types", "types",
"web3", "web3",
@ -2008,7 +2008,7 @@ dependencies = [
"task_executor", "task_executor",
"tempfile", "tempfile",
"tiny-keccak 2.0.2", "tiny-keccak 2.0.2",
"tokio 1.6.0", "tokio 1.6.1",
"tokio-io-timeout", "tokio-io-timeout",
"tokio-util 0.6.7", "tokio-util 0.6.7",
"types", "types",
@ -2490,7 +2490,7 @@ dependencies = [
"serde_derive", "serde_derive",
"slog", "slog",
"state_processing", "state_processing",
"tokio 1.6.0", "tokio 1.6.1",
"tokio-compat-02", "tokio-compat-02",
"tree_hash", "tree_hash",
"types", "types",
@ -2620,7 +2620,7 @@ dependencies = [
"http", "http",
"indexmap", "indexmap",
"slab", "slab",
"tokio 1.6.0", "tokio 1.6.1",
"tokio-util 0.6.7", "tokio-util 0.6.7",
"tracing", "tracing",
] ]
@ -2654,7 +2654,7 @@ name = "hashset_delay"
version = "0.2.0" version = "0.2.0"
dependencies = [ dependencies = [
"futures 0.3.15", "futures 0.3.15",
"tokio 1.6.0", "tokio 1.6.1",
"tokio-util 0.6.7", "tokio-util 0.6.7",
] ]
@ -2842,7 +2842,7 @@ dependencies = [
"slot_clock", "slot_clock",
"state_processing", "state_processing",
"store", "store",
"tokio 1.6.0", "tokio 1.6.1",
"tokio-stream", "tokio-stream",
"tokio-util 0.6.7", "tokio-util 0.6.7",
"tree_hash", "tree_hash",
@ -2869,7 +2869,7 @@ dependencies = [
"slog", "slog",
"slot_clock", "slot_clock",
"store", "store",
"tokio 1.6.0", "tokio 1.6.1",
"types", "types",
"warp", "warp",
"warp_utils", "warp_utils",
@ -2917,7 +2917,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"serde_regex", "serde_regex",
"tokio 1.6.0", "tokio 1.6.1",
] ]
[[package]] [[package]]
@ -2968,7 +2968,7 @@ dependencies = [
"itoa", "itoa",
"pin-project 1.0.7", "pin-project 1.0.7",
"socket2 0.4.0", "socket2 0.4.0",
"tokio 1.6.0", "tokio 1.6.1",
"tower-service", "tower-service",
"tracing", "tracing",
"want", "want",
@ -3014,7 +3014,7 @@ dependencies = [
"bytes 1.0.1", "bytes 1.0.1",
"hyper 0.14.8", "hyper 0.14.8",
"native-tls", "native-tls",
"tokio 1.6.0", "tokio 1.6.1",
"tokio-native-tls", "tokio-native-tls",
] ]
@ -3343,7 +3343,7 @@ dependencies = [
"serde_yaml", "serde_yaml",
"simple_logger", "simple_logger",
"state_processing", "state_processing",
"tokio 1.6.0", "tokio 1.6.1",
"tree_hash", "tree_hash",
"types", "types",
"validator_dir", "validator_dir",
@ -3617,7 +3617,7 @@ dependencies = [
"libp2p-core", "libp2p-core",
"log", "log",
"socket2 0.4.0", "socket2 0.4.0",
"tokio 1.6.0", "tokio 1.6.1",
] ]
[[package]] [[package]]
@ -3721,7 +3721,7 @@ dependencies = [
"sloggers", "sloggers",
"task_executor", "task_executor",
"tempfile", "tempfile",
"tokio 1.6.0", "tokio 1.6.1",
"types", "types",
"validator_client", "validator_client",
"validator_dir", "validator_dir",
@ -4046,7 +4046,7 @@ dependencies = [
"slog", "slog",
"store", "store",
"task_executor", "task_executor",
"tokio 1.6.0", "tokio 1.6.1",
] ]
[[package]] [[package]]
@ -4182,7 +4182,7 @@ dependencies = [
"strum", "strum",
"task_executor", "task_executor",
"tempfile", "tempfile",
"tokio 1.6.0", "tokio 1.6.1",
"tokio-stream", "tokio-stream",
"tokio-util 0.6.7", "tokio-util 0.6.7",
"tree_hash", "tree_hash",
@ -5218,7 +5218,7 @@ dependencies = [
"reqwest", "reqwest",
"sensitive_url", "sensitive_url",
"serde", "serde",
"tokio 1.6.0", "tokio 1.6.1",
"types", "types",
] ]
@ -5237,7 +5237,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"tempfile", "tempfile",
"tokio 1.6.0", "tokio 1.6.1",
"types", "types",
"winapi 0.3.9", "winapi 0.3.9",
"windows-acl", "windows-acl",
@ -5278,7 +5278,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"serde_urlencoded", "serde_urlencoded",
"tokio 1.6.0", "tokio 1.6.1",
"tokio-native-tls", "tokio-native-tls",
"url", "url",
"wasm-bindgen", "wasm-bindgen",
@ -5825,7 +5825,7 @@ dependencies = [
"parking_lot", "parking_lot",
"rayon", "rayon",
"sensitive_url", "sensitive_url",
"tokio 1.6.0", "tokio 1.6.1",
"types", "types",
"validator_client", "validator_client",
] ]
@ -5884,7 +5884,7 @@ dependencies = [
"slot_clock", "slot_clock",
"state_processing", "state_processing",
"task_executor", "task_executor",
"tokio 1.6.0", "tokio 1.6.1",
"tokio-stream", "tokio-stream",
"types", "types",
] ]
@ -6341,7 +6341,7 @@ dependencies = [
"lazy_static", "lazy_static",
"lighthouse_metrics", "lighthouse_metrics",
"slog", "slog",
"tokio 1.6.0", "tokio 1.6.1",
] ]
[[package]] [[package]]
@ -6502,7 +6502,7 @@ dependencies = [
"slog", "slog",
"slot_clock", "slot_clock",
"task_executor", "task_executor",
"tokio 1.6.0", "tokio 1.6.1",
"types", "types",
] ]
@ -6604,9 +6604,9 @@ dependencies = [
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.6.0" version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd3076b5c8cc18138b8f8814895c11eb4de37114a5d127bafdc5e55798ceef37" checksum = "0a38d31d7831c6ed7aad00aa4c12d9375fd225a6dd77da1d25b707346319a975"
dependencies = [ dependencies = [
"autocfg 1.0.1", "autocfg 1.0.1",
"bytes 1.0.1", "bytes 1.0.1",
@ -6642,7 +6642,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90c49f106be240de154571dd31fbe48acb10ba6c6dd6f6517ad603abffa42de9" checksum = "90c49f106be240de154571dd31fbe48acb10ba6c6dd6f6517ad603abffa42de9"
dependencies = [ dependencies = [
"pin-project-lite 0.2.6", "pin-project-lite 0.2.6",
"tokio 1.6.0", "tokio 1.6.1",
] ]
[[package]] [[package]]
@ -6674,7 +6674,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b"
dependencies = [ dependencies = [
"native-tls", "native-tls",
"tokio 1.6.0", "tokio 1.6.1",
] ]
[[package]] [[package]]
@ -6685,7 +6685,7 @@ checksum = "f8864d706fdb3cc0843a49647ac892720dac98a6eeb818b77190592cf4994066"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"pin-project-lite 0.2.6", "pin-project-lite 0.2.6",
"tokio 1.6.0", "tokio 1.6.1",
"tokio-util 0.6.7", "tokio-util 0.6.7",
] ]
@ -6708,7 +6708,7 @@ dependencies = [
"futures-util", "futures-util",
"log", "log",
"pin-project 1.0.7", "pin-project 1.0.7",
"tokio 1.6.0", "tokio 1.6.1",
"tungstenite", "tungstenite",
] ]
@ -6754,7 +6754,7 @@ dependencies = [
"log", "log",
"pin-project-lite 0.2.6", "pin-project-lite 0.2.6",
"slab", "slab",
"tokio 1.6.0", "tokio 1.6.1",
] ]
[[package]] [[package]]
@ -6920,7 +6920,7 @@ dependencies = [
"smallvec", "smallvec",
"thiserror", "thiserror",
"tinyvec", "tinyvec",
"tokio 1.6.0", "tokio 1.6.1",
"url", "url",
] ]
@ -6940,7 +6940,7 @@ dependencies = [
"resolv-conf", "resolv-conf",
"smallvec", "smallvec",
"thiserror", "thiserror",
"tokio 1.6.0", "tokio 1.6.1",
"trust-dns-proto", "trust-dns-proto",
] ]
@ -7095,9 +7095,9 @@ dependencies = [
[[package]] [[package]]
name = "unicode-normalization" name = "unicode-normalization"
version = "0.1.17" version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07fbfce1c8a97d547e8b5334978438d9d6ec8c20e38f56d4a4374d181493eaef" checksum = "33717dca7ac877f497014e10d73f3acf948c342bee31b5ca7892faf94ccc6b49"
dependencies = [ dependencies = [
"tinyvec", "tinyvec",
] ]
@ -7241,7 +7241,7 @@ dependencies = [
"slog-term", "slog-term",
"slot_clock", "slot_clock",
"tempfile", "tempfile",
"tokio 1.6.0", "tokio 1.6.1",
"tree_hash", "tree_hash",
"types", "types",
"validator_dir", "validator_dir",
@ -7349,7 +7349,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"serde_urlencoded", "serde_urlencoded",
"tokio 1.6.0", "tokio 1.6.1",
"tokio-stream", "tokio-stream",
"tokio-tungstenite", "tokio-tungstenite",
"tokio-util 0.6.7", "tokio-util 0.6.7",
@ -7370,7 +7370,7 @@ dependencies = [
"safe_arith", "safe_arith",
"serde", "serde",
"state_processing", "state_processing",
"tokio 1.6.0", "tokio 1.6.1",
"types", "types",
"warp", "warp",
] ]

View File

@ -160,6 +160,7 @@ impl<TSpec: EthSpec> PeerDB<TSpec> {
self.connection_status(peer_id), self.connection_status(peer_id),
Some(PeerConnectionStatus::Disconnected { .. }) Some(PeerConnectionStatus::Disconnected { .. })
| Some(PeerConnectionStatus::Unknown { .. }) | Some(PeerConnectionStatus::Unknown { .. })
| None
) && !self.is_banned_or_disconnected(peer_id) ) && !self.is_banned_or_disconnected(peer_id)
} }