@@ -178,13 +178,13 @@ struct ConsensusCache<ContextT: ConsensusContext> {
178178 // Mapping: { Height : Vec<Vote> }
179179 future_votes : BTreeMap < BlockNumber , Vec < Vote > > ,
180180 // Mapping: { Height : { Round : (Init, Receiver)}}
181- cached_proposals :
181+ future_proposals_cache :
182182 BTreeMap < BlockNumber , BTreeMap < Round , ProposalReceiverTuple < ContextT :: ProposalPart > > > ,
183183}
184184
185185impl < ContextT : ConsensusContext > ConsensusCache < ContextT > {
186186 fn new ( ) -> Self {
187- Self { future_votes : BTreeMap :: new ( ) , cached_proposals : BTreeMap :: new ( ) }
187+ Self { future_votes : BTreeMap :: new ( ) , future_proposals_cache : BTreeMap :: new ( ) }
188188 }
189189
190190 /// Filters the cached messages:
@@ -214,7 +214,7 @@ impl<ContextT: ConsensusContext> ConsensusCache<ContextT> {
214214 height : BlockNumber ,
215215 ) -> Vec < ( ProposalInit , mpsc:: Receiver < ContextT :: ProposalPart > ) > {
216216 loop {
217- let Some ( entry) = self . cached_proposals . first_entry ( ) else {
217+ let Some ( entry) = self . future_proposals_cache . first_entry ( ) else {
218218 return Vec :: new ( ) ;
219219 } ;
220220 match entry. key ( ) . cmp ( & height) {
@@ -247,7 +247,7 @@ impl<ContextT: ConsensusContext> ConsensusCache<ContextT> {
247247 proposal_init : ProposalInit ,
248248 content_receiver : mpsc:: Receiver < ContextT :: ProposalPart > ,
249249 ) {
250- self . cached_proposals
250+ self . future_proposals_cache
251251 . entry ( proposal_init. height )
252252 . or_default ( )
253253 . entry ( proposal_init. round )
@@ -256,7 +256,7 @@ impl<ContextT: ConsensusContext> ConsensusCache<ContextT> {
256256
257257 fn report_max_cached_block_number_metric ( & self , height : BlockNumber ) {
258258 // If nothing is cached use current height as "max".
259- let max_cached_block_number = self . cached_proposals . keys ( ) . max ( ) . unwrap_or ( & height) ;
259+ let max_cached_block_number = self . future_proposals_cache . keys ( ) . max ( ) . unwrap_or ( & height) ;
260260 CONSENSUS_MAX_CACHED_BLOCK_NUMBER . set_lossy ( max_cached_block_number. 0 ) ;
261261 }
262262
@@ -281,7 +281,8 @@ struct MultiHeightManager<ContextT: ConsensusContext> {
281281 #[ allow( dead_code) ]
282282 voted_height_storage : Arc < Mutex < dyn HeightVotedStorageTrait > > ,
283283 // Proposal content streams keyed by (height, round)
284- proposal_streams : BTreeMap < ( BlockNumber , Round ) , mpsc:: Receiver < ContextT :: ProposalPart > > ,
284+ current_height_proposals_streams :
285+ BTreeMap < ( BlockNumber , Round ) , mpsc:: Receiver < ContextT :: ProposalPart > > ,
285286 cache : ConsensusCache < ContextT > ,
286287}
287288
@@ -302,7 +303,7 @@ impl<ContextT: ConsensusContext> MultiHeightManager<ContextT> {
302303 quorum_type,
303304 last_voted_height_at_initialization,
304305 voted_height_storage,
305- proposal_streams : BTreeMap :: new ( ) ,
306+ current_height_proposals_streams : BTreeMap :: new ( ) ,
306307 cache : ConsensusCache :: new ( ) ,
307308 }
308309 }
@@ -353,7 +354,7 @@ impl<ContextT: ConsensusContext> MultiHeightManager<ContextT> {
353354 }
354355
355356 // Height completed; clear any content streams associated with current and lower heights.
356- self . proposal_streams . retain ( |( h, _) , _| * h > height) ;
357+ self . current_height_proposals_streams . retain ( |( h, _) , _| * h > height) ;
357358
358359 Ok ( res)
359360 }
@@ -665,7 +666,8 @@ impl<ContextT: ConsensusContext> MultiHeightManager<ContextT> {
665666 content_receiver : mpsc:: Receiver < ContextT :: ProposalPart > ,
666667 ) -> Result < ShcReturn , ConsensusError > {
667668 // Store the stream; requests will reference it by (height, round)
668- self . proposal_streams . insert ( ( height, proposal_init. round ) , content_receiver) ;
669+ self . current_height_proposals_streams
670+ . insert ( ( height, proposal_init. round ) , content_receiver) ;
669671 let leader_fn = make_leader_fn ( context, height) ;
670672 shc. handle_proposal ( & leader_fn, proposal_init)
671673 }
@@ -792,7 +794,7 @@ impl<ContextT: ConsensusContext> MultiHeightManager<ContextT> {
792794 SMRequest :: StartValidateProposal ( init) => {
793795 // Look up the stored stream.
794796 let key = ( height, init. round ) ;
795- if let Some ( stream) = self . proposal_streams . remove ( & key) {
797+ if let Some ( stream) = self . current_height_proposals_streams . remove ( & key) {
796798 let timeout = timeouts. get_proposal_timeout ( init. round ) ;
797799 let receiver = context. validate_proposal ( init, timeout, stream) . await ;
798800 let round = init. round ;
0 commit comments