Skip to content

Commit 817c54f

Browse files
committed
fixes after review
1 parent 743423b commit 817c54f

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

process/block/metablockProposal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ func (mp *metaProcessor) checkHeadersSequenceCorrectness(hdrsForShard []ShardHea
12061206
}
12071207

12081208
if mp.blockTracker.IsHeaderQuarantined(shardHdrInfo.Hash) {
1209-
return fmt.Errorf("%w with hash %s", errIncludedQuarantinedHeader, shardHdrInfo.Hash)
1209+
return fmt.Errorf("%w with hash %x", errIncludedQuarantinedHeader, shardHdrInfo.Hash)
12101210
}
12111211

12121212
err = mp.headerValidator.IsHeaderConstructionValid(shardHdrInfo.Header, lastNotarizedHeaderInfoForShard.Header)

process/block/shardblockProposal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ func (sp *shardProcessor) checkMetaHeadersValidityAndFinalityProposal(header dat
824824

825825
for idx, metaHeader := range usedMetaHeaders {
826826
if sp.blockTracker.IsHeaderQuarantined(usedMetaHashes[idx]) {
827-
return fmt.Errorf("%w with hash %s", errIncludedQuarantinedHeader, usedMetaHashes[idx])
827+
return fmt.Errorf("%w with hash %x", errIncludedQuarantinedHeader, usedMetaHashes[idx])
828828
}
829829

830830
err = sp.headerValidator.IsHeaderConstructionValid(metaHeader, lastCrossNotarizedHeader)

process/track/baseBlockTrack.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ var log = logger.GetOrCreate("process/track")
2828

2929
const maxNonceDifference = 3 // TODO move this to a config file
3030

31+
const maxQuarantineRoundDelta = 3
32+
3133
// HeaderInfo holds the information about a header
3234
type HeaderInfo struct {
3335
Hash []byte
@@ -206,12 +208,12 @@ func (bbt *baseBlockTrack) sweepQuarantinedHeaders(ctx context.Context) {
206208
currentRound := bbt.roundHandler.Index()
207209
for _, key := range bbt.quarantinedHeaders.Keys() {
208210
val, _ := bbt.quarantinedHeaders.Get(key)
209-
headerRound, ok := val.(int64)
211+
headerRound, ok := val.(uint64)
210212
if !ok {
211213
continue
212214
}
213215

214-
if currentRound-headerRound < maxNonceDifference {
216+
if currentRound-int64(headerRound) < maxQuarantineRoundDelta {
215217
continue
216218
}
217219

@@ -938,7 +940,9 @@ func (bbt *baseBlockTrack) restoreTrackedHeadersToGenesis() {
938940

939941
// Close closes the internal loop
940942
func (bbt *baseBlockTrack) Close() error {
941-
bbt.cancelFunc()
943+
if bbt.cancelFunc != nil {
944+
bbt.cancelFunc()
945+
}
942946

943947
return nil
944948
}

0 commit comments

Comments
 (0)