@@ -1237,12 +1237,12 @@ where
12371237
12381238 // update vote_state round
12391239 // it's ok if not leader for round; we will never propose
1240- self . consensus
1241- . vote_state
1242- . start_new_round ( self . consensus . pacemaker . get_current_round ( ) ) ;
1243- self . consensus
1244- . no_endorsement_state
1245- . start_new_round ( self . consensus . pacemaker . get_current_round ( ) ) ;
1240+ let round = self . consensus . pacemaker . get_current_round ( ) ;
1241+ self . consensus . vote_state . start_new_round ( round ) ;
1242+ self . consensus . no_endorsement_state . start_new_round ( round ) ;
1243+
1244+ let round_leader = self . lookup_leader ( round ) ;
1245+ debug ! ( ?round , ?round_leader , "leader for round" ) ;
12461246
12471247 cmds. extend ( self . try_propose ( ) ) ;
12481248
@@ -1281,6 +1281,10 @@ where
12811281 )
12821282 } ) ,
12831283 ) ;
1284+ let round = self . consensus . pacemaker . get_current_round ( ) ;
1285+ let round_leader = self . lookup_leader ( round) ;
1286+ debug ! ( ?round, ?round_leader, "leader for round" ) ;
1287+
12841288 cmds. extend ( self . try_propose ( ) ) ;
12851289 cmds
12861290 }
@@ -1882,6 +1886,15 @@ where
18821886 . filter_map ( |( nodeid, _) | ( nodeid != * self . nodeid ) . then_some ( nodeid) )
18831887 . unique ( )
18841888 }
1889+
1890+ fn lookup_leader ( & self , round : Round ) -> Option < NodeId < CertificateSignaturePubKey < ST > > > {
1891+ let epoch = self . epoch_manager . get_epoch ( round) ?;
1892+ let validator_set = self . val_epoch_map . get_val_set ( & epoch) ?;
1893+ Some (
1894+ self . election
1895+ . get_leader ( round, epoch, validator_set. get_members ( ) ) ,
1896+ )
1897+ }
18851898}
18861899
18871900#[ cfg( test) ]
0 commit comments