Merge pull request #743 from XinFinOrg/bug-fix-use-right-block-to-count-vote-theshold

bug fix use right block to count vote threshold
This commit is contained in:
Anil Chinchawale 2024-11-22 13:37:57 +05:30 committed by GitHub
commit fe801c88d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -76,7 +76,7 @@ func (x *XDPoS_v2) voteHandler(chain consensus.ChainReader, voteMsg *types.Vote)
go x.ForensicsProcessor.DetectEquivocationInVotePool(voteMsg, x.votePool) go x.ForensicsProcessor.DetectEquivocationInVotePool(voteMsg, x.votePool)
go x.ForensicsProcessor.ProcessVoteEquivocation(chain, x, voteMsg) go x.ForensicsProcessor.ProcessVoteEquivocation(chain, x, voteMsg)
epochInfo, err := x.getEpochSwitchInfo(chain, chain.CurrentHeader(), chain.CurrentHeader().Hash()) epochInfo, err := x.getEpochSwitchInfo(chain, nil, voteMsg.ProposedBlockInfo.Hash)
if err != nil { if err != nil {
log.Error("[voteHandler] Error when getting epoch switch Info", "error", err) log.Error("[voteHandler] Error when getting epoch switch Info", "error", err)
return errors.New("fail on voteHandler due to failure in getting epoch switch info") return errors.New("fail on voteHandler due to failure in getting epoch switch info")
@ -175,7 +175,7 @@ func (x *XDPoS_v2) onVotePoolThresholdReached(chain consensus.ChainReader, poole
} }
} }
epochInfo, err := x.getEpochSwitchInfo(chain, chain.CurrentHeader(), chain.CurrentHeader().Hash()) epochInfo, err := x.getEpochSwitchInfo(chain, nil, currentVoteMsg.(*types.Vote).ProposedBlockInfo.Hash)
if err != nil { if err != nil {
log.Error("[voteHandler] Error when getting epoch switch Info", "error", err) log.Error("[voteHandler] Error when getting epoch switch Info", "error", err)
return errors.New("fail on voteHandler due to failure in getting epoch switch info") return errors.New("fail on voteHandler due to failure in getting epoch switch info")