Skip to content

Commit 7d68e8b

Browse files
committed
Fix data race
Signed-off-by: Yacov Manevich <yacov.manevich@avalabs.org>
1 parent 2b8c13a commit 7d68e8b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

epoch.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2033,7 +2033,6 @@ func (e *Epoch) createBlockVerificationTask(block Block, from NodeID, vote Vote)
20332033
func (e *Epoch) createFinalizedBlockVerificationTask(block Block, finalization *Finalization) func() Digest {
20342034
return func() Digest {
20352035
md := block.BlockHeader()
2036-
round := e.round
20372036
e.Logger.Debug("Block verification started", zap.Uint64("round", md.Round))
20382037
start := time.Now()
20392038
defer func() {
@@ -2056,6 +2055,8 @@ func (e *Epoch) createFinalizedBlockVerificationTask(block Block, finalization *
20562055
e.lock.Lock()
20572056
defer e.lock.Unlock()
20582057

2058+
round := e.round
2059+
20592060
// we started verifying the block when it was the next sequence to commit, however its
20602061
// possible we received a finalization for this block in the meantime. This check ensures we commit
20612062
// the block only if it is still the next sequence to commit.

0 commit comments

Comments
 (0)