Skip to content

Commit

Permalink
cosmetic changes + empty chan
Browse files Browse the repository at this point in the history
  • Loading branch information
sstanculeanu committed Feb 11, 2025
1 parent 32d381c commit fe0aace
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
8 changes: 5 additions & 3 deletions process/block/baseProcess.go
Original file line number Diff line number Diff line change
Expand Up @@ -2401,14 +2401,16 @@ func (bp *baseProcessor) checkReceivedHeaderAndUpdateMissingAttesting(headerHand
return
}

bp.mutRequestedAttestingNoncesMap.Lock()
defer bp.mutRequestedAttestingNoncesMap.Unlock()

bp.mutRequestedAttestingNoncesMap.RLock()
isWaitingForProofs := len(bp.requestedAttestingNoncesMap) > 0
defer bp.mutRequestedAttestingNoncesMap.RUnlock()
if !isWaitingForProofs {
return
}

bp.mutRequestedAttestingNoncesMap.Lock()
defer bp.mutRequestedAttestingNoncesMap.Unlock()

receivedShard := headerHandler.GetShardID()
prevHash := headerHandler.GetPrevHash()
_, isHeaderWithoutProof := bp.requestedAttestingNoncesMap[string(prevHash)]
Expand Down
1 change: 1 addition & 0 deletions process/block/metablock.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ func (mp *metaProcessor) checkProofsForShardData(header *block.MetaBlock) error

mp.mutRequestedAttestingNoncesMap.Lock()
mp.requestedAttestingNoncesMap = make(map[string]uint64)
_ = core.EmptyChannel(mp.allProofsReceived)
mp.mutRequestedAttestingNoncesMap.Unlock()

for _, shardData := range header.ShardInfo {
Expand Down
1 change: 1 addition & 0 deletions process/block/shardblock.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ func (sp *shardProcessor) ProcessBlock(

sp.mutRequestedAttestingNoncesMap.Lock()
sp.requestedAttestingNoncesMap = make(map[string]uint64)
_ = core.EmptyChannel(sp.allProofsReceived)
sp.mutRequestedAttestingNoncesMap.Unlock()

// check proofs for cross notarized metablocks
Expand Down

0 comments on commit fe0aace

Please sign in to comment.