mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2024-11-14 12:05:17 +00:00
Ban peer if failed to decode pubsub message (#259)
Some checks are pending
abi-consistent-check / build-and-compare (push) Waiting to run
code-coverage / unittest-cov (push) Waiting to run
rust / check (push) Waiting to run
rust / test (push) Waiting to run
rust / lints (push) Waiting to run
functional-test / test (push) Waiting to run
Some checks are pending
abi-consistent-check / build-and-compare (push) Waiting to run
code-coverage / unittest-cov (push) Waiting to run
rust / check (push) Waiting to run
rust / test (push) Waiting to run
rust / lints (push) Waiting to run
functional-test / test (push) Waiting to run
This commit is contained in:
parent
cae5b62440
commit
bcbd8b3baa
@ -592,7 +592,7 @@ where
|
|||||||
// peer that originally published the message.
|
// peer that originally published the message.
|
||||||
match PubsubMessage::decode(&gs_msg.topic, &gs_msg.data) {
|
match PubsubMessage::decode(&gs_msg.topic, &gs_msg.data) {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
debug!(topic = ?gs_msg.topic, error = ?e, "Could not decode gossipsub message");
|
debug!(topic = ?gs_msg.topic, %propagation_source, error = ?e, "Could not decode gossipsub message");
|
||||||
//reject the message
|
//reject the message
|
||||||
if let Err(e) = self.gossipsub.report_message_validation_result(
|
if let Err(e) = self.gossipsub.report_message_validation_result(
|
||||||
&id,
|
&id,
|
||||||
@ -601,6 +601,24 @@ where
|
|||||||
) {
|
) {
|
||||||
warn!(message_id = %id, peer_id = %propagation_source, error = ?e, "Failed to report message validation");
|
warn!(message_id = %id, peer_id = %propagation_source, error = ?e, "Failed to report message validation");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.peer_manager.report_peer(
|
||||||
|
&propagation_source,
|
||||||
|
PeerAction::Fatal,
|
||||||
|
ReportSource::Gossipsub,
|
||||||
|
None,
|
||||||
|
"gossipsub message decode error",
|
||||||
|
);
|
||||||
|
|
||||||
|
if let Some(source) = &gs_msg.source {
|
||||||
|
self.peer_manager.report_peer(
|
||||||
|
source,
|
||||||
|
PeerAction::Fatal,
|
||||||
|
ReportSource::Gossipsub,
|
||||||
|
None,
|
||||||
|
"gossipsub message decode error",
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Ok(msg) => {
|
Ok(msg) => {
|
||||||
// Notify the network
|
// Notify the network
|
||||||
|
Loading…
Reference in New Issue
Block a user