IDONTWANT message optimisation to cutoff for smaller messages (#6456)

* idontwant message opitmising

* requested changes and linter appeasing

* added the config cli flag

* Merge branch 'unstable' into fix/idontwant-optimise

* cli docs generated

* const declaration

* Hide extra technical cli flag

* passing ci

* Merge branch 'unstable' into fix/idontwant-optimise
This commit is contained in:
hopinheimer
2024-10-17 04:27:56 -04:00
committed by GitHub
parent 7091c789c9
commit 606a113cff
7 changed files with 110 additions and 5 deletions

View File

@@ -1812,9 +1812,6 @@ where
// Calculate the message id on the transformed data.
let msg_id = self.config.message_id(&message);
// Broadcast IDONTWANT messages.
self.send_idontwant(&raw_message, &msg_id, propagation_source);
// Check the validity of the message
// Peers get penalized if this message is invalid. We don't add it to the duplicate cache
// and instead continually penalize peers that repeatedly send this message.
@@ -1830,6 +1827,12 @@ where
self.mcache.observe_duplicate(&msg_id, propagation_source);
return;
}
// Broadcast IDONTWANT messages
if raw_message.raw_protobuf_len() > self.config.idontwant_message_size_threshold() {
self.send_idontwant(&raw_message, &msg_id, propagation_source);
}
tracing::debug!(
message=%msg_id,
"Put message in duplicate_cache and resolve promises"