consensus/clique: fix overflow on recent signer check around genesis

This commit is contained in:
Péter Szilágyi 2017-05-03 11:01:06 +03:00
parent c3dc01caf1
commit bcf2465b0b
No known key found for this signature in database
GPG Key ID: E9AE538CEDF8293D
1 changed files with 1 additions and 1 deletions

View File

@ -599,7 +599,7 @@ func (c *Clique) Seal(chain consensus.ChainReader, block *types.Block, stop <-ch
for seen, recent := range snap.Recents { for seen, recent := range snap.Recents {
if recent == signer { if recent == signer {
// Signer is among recents, only wait if the current block doens't shift it out // Signer is among recents, only wait if the current block doens't shift it out
if limit := uint64(len(snap.Signers)/2 + 1); seen > number-limit { if limit := uint64(len(snap.Signers)/2 + 1); number < limit || seen > number-limit {
log.Info("Signed recently, must wait for others") log.Info("Signed recently, must wait for others")
<-stop <-stop
return nil, nil return nil, nil