diff --git a/massa-models/src/config/constants.rs b/massa-models/src/config/constants.rs index 7125d36b4e3..599efa816f4 100644 --- a/massa-models/src/config/constants.rs +++ b/massa-models/src/config/constants.rs @@ -171,10 +171,6 @@ pub const MAX_BOOTSTRAP_ERROR_LENGTH: u32 = 10000; pub const PROTOCOL_CONTROLLER_CHANNEL_SIZE: usize = 1024; /// Event channel size pub const PROTOCOL_EVENT_CHANNEL_SIZE: usize = 1024; -/// Time threshold after which operation are not propagated -pub const MAX_OPERATIONS_PROPAGATION_TIME: MassaTime = T0.saturating_mul(2); -/// Time threshold after which operation are not propagated -pub const MAX_ENDORSEMENTS_PROPAGATION_TIME: MassaTime = T0.saturating_mul(3); // *********************** // Constants used for execution module (injected from ConsensusConfig) // diff --git a/massa-node/base_config/config.toml b/massa-node/base_config/config.toml index 9dc4037382a..3bddf70a210 100644 --- a/massa-node/base_config/config.toml +++ b/massa-node/base_config/config.toml @@ -87,6 +87,10 @@ asked_operations_pruning_period = 100000 # Max number of operation per message, same as network param but can be smaller max_operations_per_message = 1024 + # Time threshold after which operation are not propagated + max_operations_propagation_time = 32000 + # Time threshold after which operation are not propagated + max_endorsements_propagation_time = 48000 [network] # port on which to listen for protocol communication diff --git a/massa-node/src/main.rs b/massa-node/src/main.rs index ccd77dfd5f8..206fb25cafd 100644 --- a/massa-node/src/main.rs +++ b/massa-node/src/main.rs @@ -37,8 +37,7 @@ use massa_models::config::constants::{ PERIODS_PER_CYCLE, ROLL_PRICE, T0, THREAD_COUNT, VERSION, }; use massa_models::config::{ - ASYNC_POOL_PART_SIZE_MESSAGE_BYTES, CHANNEL_SIZE, DELTA_F0, MAX_ENDORSEMENTS_PROPAGATION_TIME, - MAX_OPERATIONS_PROPAGATION_TIME, NETWORK_NODE_COMMAND_CHANNEL_SIZE, + ASYNC_POOL_PART_SIZE_MESSAGE_BYTES, CHANNEL_SIZE, DELTA_F0, NETWORK_NODE_COMMAND_CHANNEL_SIZE, NETWORK_NODE_EVENT_CHANNEL_SIZE, POS_MISS_RATE_DEACTIVATION_THRESHOLD, PROTOCOL_CONTROLLER_CHANNEL_SIZE, PROTOCOL_EVENT_CHANNEL_SIZE, }; @@ -326,8 +325,8 @@ async fn launch( event_channel_size: PROTOCOL_EVENT_CHANNEL_SIZE, genesis_timestamp: *GENESIS_TIMESTAMP, t0: T0, - max_operations_propagation_time: MAX_OPERATIONS_PROPAGATION_TIME, - max_endorsements_propagation_time: MAX_ENDORSEMENTS_PROPAGATION_TIME, + max_operations_propagation_time: SETTINGS.protocol.max_operations_propagation_time, + max_endorsements_propagation_time: SETTINGS.protocol.max_endorsements_propagation_time, }; let (protocol_command_sender, protocol_event_receiver, protocol_manager) = start_protocol_controller( diff --git a/massa-node/src/settings.rs b/massa-node/src/settings.rs index 190efc64069..0a2ca323f88 100644 --- a/massa-node/src/settings.rs +++ b/massa-node/src/settings.rs @@ -186,6 +186,10 @@ pub struct ProtocolSettings { pub asked_operations_pruning_period: MassaTime, /// Maximum of operations sent in one message. pub max_operations_per_message: u64, + /// Time threshold after which operation are not propagated + pub max_operations_propagation_time: MassaTime, + /// Time threshold after which operation are not propagated + pub max_endorsements_propagation_time: MassaTime, } #[cfg(test)] diff --git a/massa-protocol-worker/src/protocol_worker.rs b/massa-protocol-worker/src/protocol_worker.rs index 8bd065e431e..3e32f747bd0 100644 --- a/massa-protocol-worker/src/protocol_worker.rs +++ b/massa-protocol-worker/src/protocol_worker.rs @@ -964,15 +964,19 @@ impl ProtocolWorker { self.config.t0, self.config.genesis_timestamp, Slot::new(expire_period, 0), - ) - .ok()?; - if expire_period_timestamp - .saturating_add(self.config.max_operations_propagation_time) - < now - { - Some(*op_id) - } else { - None + ); + match expire_period_timestamp { + Ok(slot_timestamp) => { + if slot_timestamp + .saturating_add(self.config.max_endorsements_propagation_time) + < now + { + Some(*op_id) + } else { + None + } + } + Err(_) => Some(*op_id), } }) .collect() @@ -1056,15 +1060,19 @@ impl ProtocolWorker { self.config.t0, self.config.genesis_timestamp, slot_endorsed_block, - ) - .ok()?; - if slot_timestamp - .saturating_add(self.config.max_endorsements_propagation_time) - < now - { - Some(*endorsement_id) - } else { - None + ); + match slot_timestamp { + Ok(slot_timestamp) => { + if slot_timestamp.saturating_add( + self.config.max_endorsements_propagation_time, + ) < now + { + Some(*endorsement_id) + } else { + None + } + } + Err(_) => Some(*endorsement_id), } }) .collect()