diff options
| author | tv <tv@krebsco.de> | 2026-11-06 04:35:12 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-06 04:35:12 +0100 |
| commit | 9d6d7913ce8bf76717f75d7d4845a61f4889da80 (patch) | |
| tree | 463bf53102c66f002b760002e86c7ef94ce2caa5 /src/transport/mycelium/mod.rs | |
| parent | ceeec6f661e13a2d9fc7d28f88450f6d45af5c43 (diff) | |
other wire versions warned
Diffstat (limited to 'src/transport/mycelium/mod.rs')
| -rw-r--r-- | src/transport/mycelium/mod.rs | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/transport/mycelium/mod.rs b/src/transport/mycelium/mod.rs index 369d683..f1dbe40 100644 --- a/src/transport/mycelium/mod.rs +++ b/src/transport/mycelium/mod.rs @@ -41,8 +41,6 @@ const POST_MIN_RATE: u64 = 1 << 20; /// The one Mycelium topic all of continuum's messages travel on; what a message is, its /// payload says (`wire`). const TOPIC: &str = "continuum"; -/// How many senders on another wire version are remembered as already logged. -const MAX_OTHER_VERSIONS: usize = 1024; const EMPTY_QUEUE_DELAY: Duration = Duration::from_millis(25); @@ -398,8 +396,7 @@ impl Transport for MyceliumTransport { } async fn start_consumer(&self, handler: MessageHandler) -> Result<()> { - // Senders on another wire version, logged once each. - let mut other_versions = std::collections::HashSet::new(); + let other_versions = wire::OtherVersions::default(); tracing::info!( endpoint = self.messages_endpoint.as_str(), "Starting the consumer" @@ -451,18 +448,7 @@ impl Transport for MyceliumTransport { } } Err(TransportError::Wire(wire::WireError::Version(version))) => { - // Bounded: anyone can send us anything. - if other_versions.len() >= MAX_OTHER_VERSIONS { - other_versions.clear(); - } - if other_versions.insert(inbound_message.src_pk.clone()) { - tracing::warn!( - from = %Addressed(SCHEME, &inbound_message.src_pk), - version, - ours = wire::VERSION, - "Peer speaks another wire version (another build); ignoring its messages" - ); - } + other_versions.note(SCHEME, &inbound_message.src_pk, version); } Err(transport_error) => { // Who sent it and what it claims to be. |
