commit 1cc0f3b34c7ff29675d5130a1c17fe5ab7f16ac6 from: murilo ijanc date: Thu Mar 26 01:19:32 2026 UTC Add unban() to BanList and expose it on Node Allows callers to clear bans for specific addresses, needed for re-join logic where bootstrap peers may have been banned after transient failures. commit - 97cc9c29c3017c7d72d304e4206aefcdf4839c85 commit + 1cc0f3b34c7ff29675d5130a1c17fe5ab7f16ac6 blob - f01e31a555c1ffeb91060e98e0ad055e1611dbf2 blob + 482724296d5585e96ad451f1537d45e7c8b1baf9 --- src/banlist.rs +++ src/banlist.rs @@ -102,6 +102,12 @@ impl BanList { .retain(|_, e| e.last_failure.elapsed() < self.ban_duration); } + /// Remove a specific ban and its failure history. + pub fn unban(&mut self, addr: &SocketAddr) { + self.bans.remove(addr); + self.failures.remove(addr); + } + /// Number of currently active bans. pub fn ban_count(&self) -> usize { self.bans blob - fef917e85a8278976127bfbe2ed3be7661c27af4 blob + 2c3cec98ae9d474b8ab3890d58ca080b1b16ff9a --- src/node.rs +++ src/node.rs @@ -1165,6 +1165,11 @@ impl Node { self.peers.len() } + /// Remove a ban for a specific address. + pub fn unban(&mut self, addr: &std::net::SocketAddr) { + self.ban_list.unban(addr); + } + /// Snapshot of metrics counters. pub fn metrics(&self) -> crate::metrics::MetricsSnapshot { self.metrics.snapshot()