@@ -26,7 +26,7 @@ use malachitebft_app_channel::app::types::LocallyProposedValue;
2626use malachitebft_app_channel:: { NetworkMsg , Reply } ;
2727use malachitebft_core_types:: Validity ;
2828
29- use arc_consensus_types:: { Address , ArcContext , Height } ;
29+ use arc_consensus_types:: { Address , ArcContext , Height , ValueId } ;
3030use arc_eth_engine:: engine:: Engine ;
3131use arc_eth_engine:: json_structures:: ExecutionBlock ;
3232use arc_signer:: ArcSigningProvider ;
@@ -90,12 +90,7 @@ pub async fn handle(
9090
9191 if let Some ( proposed_value) = proposed_value {
9292 if round. as_i64 ( ) == 0 {
93- if let Some ( monitor) = & mut state. proposal_monitor {
94- debug_assert_eq ! ( monitor. height, height, "proposal monitor height mismatch" ) ;
95- monitor. record_proposal ( proposed_value. value . id ( ) ) ;
96- } else {
97- warn ! ( %height, %round, "No proposal monitor present" ) ;
98- }
93+ record_self_proposal_in_monitor ( state, height, proposed_value. value . id ( ) ) ;
9994 }
10095
10196 if let Err ( e) = reply. send ( proposed_value) {
@@ -308,3 +303,20 @@ async fn get_previously_built_block(
308303 let block = blocks. into_iter ( ) . find ( |p| p. proposer == proposer) ;
309304 Ok ( block)
310305}
306+
307+ /// Records the proposed value in the proposal monitor for the given height, if the monitor exists.
308+ fn record_self_proposal_in_monitor ( state : & mut State , height : Height , value_id : ValueId ) {
309+ let Some ( monitor) = & mut state. proposal_monitor else {
310+ warn ! ( %height, round = 0 , "No proposal monitor present" ) ;
311+ return ;
312+ } ;
313+ debug_assert_eq ! ( monitor. height, height, "proposal monitor height mismatch" ) ;
314+ if !monitor. record_proposal ( value_id) {
315+ warn ! (
316+ height = %monitor. height,
317+ first_value = %monitor. value_id. unwrap( ) ,
318+ new_value = %value_id,
319+ "Equivocating proposal at round 0"
320+ ) ;
321+ }
322+ }
0 commit comments