mirror of
https://github.com/logos-blockchain/logos-blockchain-simulations.git
synced 2026-02-17 19:53:07 +00:00
improve: do not remove msg from cache early if the mixnode is connected to the sender in the ordering experiments
This commit is contained in:
parent
d59eab8267
commit
5fe3e4d191
@ -67,7 +67,11 @@ where
|
||||
}
|
||||
|
||||
pub fn receive(&mut self, msg: M, from: Option<NodeId>) -> bool {
|
||||
let first_received = self.check_and_update_cache(msg, false);
|
||||
// If `from` is None, it means that the message is being sent from the node outside of the gossip network.
|
||||
// In this case, the received count in the cache must start from 0, so it can be removed from the cache only when it is received from C gossip peers (not C-1).
|
||||
// For that, we set `sending` to true, as if this node is sending the message.
|
||||
let sending = from.is_none();
|
||||
let first_received = self.check_and_update_cache(msg, sending);
|
||||
if first_received {
|
||||
for (node_id, queue) in self.queues.iter_mut() {
|
||||
match from {
|
||||
@ -111,7 +115,11 @@ where
|
||||
// If the message have been received from all connected peers, remove it from the cache
|
||||
// because there is no possibility that the message will be received again.
|
||||
if received_msgs.get(&msg).unwrap() == &self.peering_degree {
|
||||
tracing::debug!("Remove message from cache: {:?}", msg);
|
||||
tracing::debug!(
|
||||
"Remove message from cache: {:?} because it has been received {} times, assuming that each inbound peer sent the message once.",
|
||||
msg,
|
||||
self.peering_degree
|
||||
);
|
||||
received_msgs.remove(&msg);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user