Skip to content

Commit 04f0830

Browse files
samliokyacovm
andauthored
more intentional calling of future messages (#271)
Co-authored-by: yacovm <[email protected]>
1 parent 46f6a2e commit 04f0830

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

epoch.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@ func (e *Epoch) persistEmptyNotarization(emptyNotarization *EmptyNotarization, s
11881188

11891189
e.increaseRound()
11901190

1191-
return errors.Join(e.startRound(), e.maybeLoadFutureMessages())
1191+
return e.startRound()
11921192
}
11931193

11941194
func (e *Epoch) maybeMarkLeaderAsTimedOutForFutureBlacklisting(emptyNotarization *EmptyNotarization) error {
@@ -1219,10 +1219,7 @@ func (e *Epoch) maybeCollectNotarization() error {
12191219
}
12201220
e.Logger.Verbo("Counting votes", zap.Uint64("round", e.round),
12211221
zap.Int("votes", voteCount), zap.String("from", fmt.Sprintf("%s", from)))
1222-
1223-
// As a last resort, check if we have received a notarization message for this round
1224-
// by attempting to load it from the future messages.
1225-
return e.maybeLoadFutureMessages()
1222+
return nil
12261223
}
12271224

12281225
block := e.rounds[e.round].block
@@ -1242,9 +1239,7 @@ func (e *Epoch) maybeCollectNotarization() error {
12421239
zap.Int("voteForOurBlock", voteCountForOurBlock),
12431240
zap.Int("total votes", voteCount))
12441241

1245-
// As a last resort, check if we have received a notarization message for this round
1246-
// by attempting to load it from the future messages.
1247-
return e.maybeLoadFutureMessages()
1242+
return nil
12481243
}
12491244

12501245
notarization, err := NewNotarization(e.Logger, e.SignatureAggregator, votesForCurrentRound, block.BlockHeader())
@@ -1309,7 +1304,7 @@ func (e *Epoch) persistAndBroadcastNotarization(notarization Notarization) error
13091304
zap.Uint64("round", notarization.Vote.Round),
13101305
zap.Stringer("digest", notarization.Vote.BlockHeader.Digest))
13111306

1312-
return errors.Join(e.doNotarized(notarization.Vote.Round), e.maybeLoadFutureMessages())
1307+
return e.doNotarized(notarization.Vote.Round)
13131308
}
13141309

13151310
func (e *Epoch) handleEmptyNotarizationMessage(emptyNotarization *EmptyNotarization, from NodeID) error {
@@ -2324,6 +2319,11 @@ func (e *Epoch) retrieveLastPersistedBlacklist() (Blacklist, bool) {
23242319
}
23252320

23262321
func (e *Epoch) startRound() error {
2322+
// before starting the round, load any future messages we might have received
2323+
if err := e.maybeLoadFutureMessages(); err != nil {
2324+
return err
2325+
}
2326+
23272327
leaderForCurrentRound := LeaderForRound(e.nodes, e.round)
23282328

23292329
if e.ID.Equals(leaderForCurrentRound) {

0 commit comments

Comments
 (0)