mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
feat: allow recents
This commit is contained in:
parent
e862e72044
commit
091e92d79c
1 changed files with 17 additions and 17 deletions
|
|
@ -494,14 +494,14 @@ func (c *Clique) verifySeal(snap *Snapshot, header *types.Header, parents []*typ
|
|||
if _, ok := snap.Signers[signer]; !ok {
|
||||
return errUnauthorizedSigner
|
||||
}
|
||||
for seen, recent := range snap.Recents {
|
||||
if recent == signer {
|
||||
// Signer is among recents, only fail if the current block doesn't shift it out
|
||||
if limit := uint64(len(snap.Signers)/2 + 1); seen > number-limit {
|
||||
return errRecentlySigned
|
||||
}
|
||||
}
|
||||
}
|
||||
// for seen, recent := range snap.Recents {
|
||||
// if recent == signer {
|
||||
// // Signer is among recents, only fail if the current block doesn't shift it out
|
||||
// if limit := uint64(len(snap.Signers)/2 + 1); seen > number-limit {
|
||||
// return errRecentlySigned
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// Ensure that the difficulty corresponds to the turn-ness of the signer
|
||||
if !c.fakeDiff {
|
||||
inturn := snap.inturn(header.Number.Uint64(), signer)
|
||||
|
|
@ -649,15 +649,15 @@ func (c *Clique) Seal(chain consensus.ChainHeaderReader, block *types.Block, res
|
|||
if _, authorized := snap.Signers[signer]; !authorized {
|
||||
return errUnauthorizedSigner
|
||||
}
|
||||
// If we're amongst the recent signers, wait for the next block
|
||||
for seen, recent := range snap.Recents {
|
||||
if recent == signer {
|
||||
// Signer is among recents, only wait if the current block doesn't shift it out
|
||||
if limit := uint64(len(snap.Signers)/2 + 1); number < limit || seen > number-limit {
|
||||
return errors.New("signed recently, must wait for others")
|
||||
}
|
||||
}
|
||||
}
|
||||
// // If we're amongst the recent signers, wait for the next block
|
||||
// for seen, recent := range snap.Recents {
|
||||
// if recent == signer {
|
||||
// // Signer is among recents, only wait if the current block doesn't shift it out
|
||||
// if limit := uint64(len(snap.Signers)/2 + 1); number < limit || seen > number-limit {
|
||||
// return errors.New("signed recently, must wait for others")
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// Sweet, the protocol permits us to sign the block, wait for our time
|
||||
delay := time.UnixMilli(int64(header.Time)).Sub(time.Now()) // nolint: gosimple
|
||||
if header.Difficulty.Cmp(diffNoTurn) == 0 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue