Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix requesting attesting blocks after equivalent proofs #6732

Merged
16 changes: 14 additions & 2 deletions process/block/baseProcess.go
Original file line number Diff line number Diff line change
Expand Up @@ -706,8 +706,11 @@ func (bp *baseProcessor) sortHeaderHashesForCurrentBlockByNonce(usedInBlock bool

func (bp *baseProcessor) hasMissingProof(headerInfo *hdrInfo, hdrHash string) bool {
isFlagEnabledForHeader := bp.enableEpochsHandler.IsFlagEnabledInEpoch(common.EquivalentMessagesFlag, headerInfo.hdr.GetEpoch())
hasProof := bp.proofsPool.HasProof(headerInfo.hdr.GetShardID(), []byte(hdrHash))
return isFlagEnabledForHeader && !hasProof
if !isFlagEnabledForHeader {
return false
}

return !bp.proofsPool.HasProof(headerInfo.hdr.GetShardID(), []byte(hdrHash))
}

func (bp *baseProcessor) createMiniBlockHeaderHandlers(
Expand Down Expand Up @@ -2232,3 +2235,12 @@ func (bp *baseProcessor) addPrevProofIfNeeded(header data.HeaderHandler) error {
header.SetPreviousProof(prevBlockProof)
return nil
}

func (bp *baseProcessor) getHeaderHash(header data.HeaderHandler) ([]byte, error) {
marshalledHeader, errMarshal := bp.marshalizer.Marshal(header)
if errMarshal != nil {
return nil, errMarshal
}

return bp.hasher.Compute(string(marshalledHeader)), nil
}
Loading
Loading