Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 6 additions & 17 deletions epoch.go
Original file line number Diff line number Diff line change
Expand Up @@ -1316,12 +1316,14 @@ func (e *Epoch) writeNotarizationToWal(notarization Notarization) error {
}

func (e *Epoch) persistNotarization(notarization Notarization) error {
if err := e.writeNotarizationToWal(notarization); err != nil {
return err
r, exists := e.rounds[notarization.Vote.Round]
if !exists {
return fmt.Errorf("attempted to store notarization of a non existent round %d", notarization.Vote.Round)
}

err := e.storeNotarization(notarization)
if err != nil {
r.notarization = &notarization

if err := e.writeNotarizationToWal(notarization); err != nil {
return err
}

Expand Down Expand Up @@ -1861,7 +1863,6 @@ func (e *Epoch) createNotarizedBlockVerificationTask(block Block, notarization N
e.Logger.Warn("Unable to get proposed block for the round", zap.Uint64("round", md.Round))
return md.Digest
}
round.notarization = &notarization

if err := e.persistNotarization(notarization); err != nil {
e.haltedError = err
Expand Down Expand Up @@ -2534,18 +2535,6 @@ func (e *Epoch) constructFinalizeVoteMessage(md BlockHeader) (FinalizeVote, *Mes
return vote, finalizationMsg, nil
}

// stores a notarization in the epoch's memory.
func (e *Epoch) storeNotarization(notarization Notarization) error {
round := notarization.Vote.Round
r, exists := e.rounds[round]
if !exists {
return fmt.Errorf("attempted to store notarization of a non existent round %d", round)
}

r.notarization = &notarization
return nil
}

func (e *Epoch) maybeLoadFutureMessages() error {
for {
round := e.round
Expand Down
Loading