Skip to content

Commit

Permalink
chore(net): track all bad reported messages (paradigmxyz#2321)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Apr 20, 2023
1 parent 1ddf178 commit d300057
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions crates/net/network/src/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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 {
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit d300057

Please sign in to comment.