gofmt, bypass signed recently for epoch block

This commit is contained in:
Tuna 2018-08-16 11:17:30 +07:00
parent 555a9bc328
commit 75d729efde

View file

@ -575,10 +575,13 @@ func (c *Clique) verifySeal(chain consensus.ChainReader, header *types.Header, p
if recent == signer {
// Signer is among recents, only fail if the current block doesn't shift it out
if limit := uint64(len(masternodes)/2 + 1); seen > number-limit {
// Only take into account the non-epoch blocks
if number%c.config.Epoch != 0 {
return errUnauthorized
}
}
}
}
return nil
}
@ -752,6 +755,8 @@ func (c *Clique) Seal(chain consensus.ChainReader, block *types.Block, stop <-ch
if recent == signer {
// Signer is among recents, only wait if the current block doesn't shift it out
if limit := uint64(len(masternodes)/2 + 1); number < limit || seen > number-limit {
// Only take into account the non-epoch blocks
if number%c.config.Epoch != 0 {
log.Info("Debugging", "len(masternodes)", len(masternodes), "number", number, "limit", limit, "seen", seen, "recent", recent.String(), "snap.Recents", snap.Recents)
log.Info("Signed recently, must wait for others")
<-stop
@ -759,6 +764,7 @@ func (c *Clique) Seal(chain consensus.ChainReader, block *types.Block, stop <-ch
}
}
}
}
// Sweet, the protocol permits us to sign the block, wait for our time
delay := time.Unix(header.Time.Int64(), 0).Sub(time.Now()) // nolint: gosimple
if header.Difficulty.Cmp(diffNoTurn) == 0 {