mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 12:46:44 +00:00
engine_v2: fix unsynchronized QC verification Error, close XFN-09 (#1609)
This commit is contained in:
parent
f519ce8500
commit
c69a536169
1 changed files with 5 additions and 5 deletions
|
|
@ -840,7 +840,7 @@ func (x *XDPoS_v2) verifyQC(blockChainReader consensus.ChainReader, quorumCert *
|
|||
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(len(signatures))
|
||||
var haveError error
|
||||
sigErrChan := make(chan error, len(signatures))
|
||||
|
||||
for _, signature := range signatures {
|
||||
go func(sig types.Signature) {
|
||||
|
|
@ -848,12 +848,12 @@ func (x *XDPoS_v2) verifyQC(blockChainReader consensus.ChainReader, quorumCert *
|
|||
verified, _, err := x.verifyMsgSignature(signedVoteObj, sig, epochInfo.Masternodes)
|
||||
if err != nil {
|
||||
log.Error("[verifyQC] Error while verfying QC message signatures", "Error", err)
|
||||
haveError = errors.New("error while verfying QC message signatures")
|
||||
sigErrChan <- errors.New("error while verfying QC message signatures")
|
||||
return
|
||||
}
|
||||
if !verified {
|
||||
log.Warn("[verifyQC] Signature not verified doing QC verification", "QC", quorumCert)
|
||||
haveError = errors.New("fail to verify QC due to signature mis-match")
|
||||
sigErrChan <- errors.New("fail to verify QC due to signature mis-match")
|
||||
return
|
||||
}
|
||||
}(signature)
|
||||
|
|
@ -861,8 +861,8 @@ func (x *XDPoS_v2) verifyQC(blockChainReader consensus.ChainReader, quorumCert *
|
|||
wg.Wait()
|
||||
elapsed := time.Since(start)
|
||||
log.Debug("[verifyQC] time verify message signatures of qc", "elapsed", elapsed)
|
||||
if haveError != nil {
|
||||
return haveError
|
||||
if len(sigErrChan) > 0 {
|
||||
return <-sigErrChan
|
||||
}
|
||||
epochSwitchNumber := epochInfo.EpochSwitchBlockInfo.Number.Uint64()
|
||||
gapNumber := epochSwitchNumber - epochSwitchNumber%x.config.Epoch - x.config.Gap
|
||||
|
|
|
|||
Loading…
Reference in a new issue