From d300057864e10d9ffb0b45a96faa9dff40bcb553 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Thu, 20 Apr 2023 22:47:51 +0200 Subject: [PATCH] chore(net): track all bad reported messages (#2321) --- crates/net/network/src/transactions.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/net/network/src/transactions.rs b/crates/net/network/src/transactions.rs index 7ae0a10f39..7d7f89f7c0 100644 --- a/crates/net/network/src/transactions.rs +++ b/crates/net/network/src/transactions.rs @@ -453,6 +453,7 @@ where fn report_bad_message(&self, peer_id: PeerId) { trace!(target: "net::tx", ?peer_id, "Penalizing peer for bad transaction"); + self.metrics.reported_bad_transactions.increment(1); self.network.reputation_change(peer_id, ReputationChangeKind::BadTransactions); } @@ -462,7 +463,6 @@ where } /// Penalize the peers that sent the bad transaction - #[allow(unused)] fn on_bad_import(&mut self, hash: TxHash) { if let Some(peers) = self.transactions_by_peers.remove(&hash) { for peer_id in peers { @@ -533,7 +533,6 @@ where if err.is_bad_transaction() && !this.network.is_syncing() { trace!(target: "net::tx", ?err, "Bad transaction import"); this.on_bad_import(*err.hash()); - this.metrics.reported_bad_transactions.increment(1); continue } this.on_good_import(*err.hash());