mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-13 23:43:47 +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 {
|
if _, ok := snap.Signers[signer]; !ok {
|
||||||
return errUnauthorizedSigner
|
return errUnauthorizedSigner
|
||||||
}
|
}
|
||||||
for seen, recent := range snap.Recents {
|
// for seen, recent := range snap.Recents {
|
||||||
if recent == signer {
|
// if recent == signer {
|
||||||
// Signer is among recents, only fail if the current block doesn't shift it out
|
// // 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 {
|
// if limit := uint64(len(snap.Signers)/2 + 1); seen > number-limit {
|
||||||
return errRecentlySigned
|
// return errRecentlySigned
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
// Ensure that the difficulty corresponds to the turn-ness of the signer
|
// Ensure that the difficulty corresponds to the turn-ness of the signer
|
||||||
if !c.fakeDiff {
|
if !c.fakeDiff {
|
||||||
inturn := snap.inturn(header.Number.Uint64(), signer)
|
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 {
|
if _, authorized := snap.Signers[signer]; !authorized {
|
||||||
return errUnauthorizedSigner
|
return errUnauthorizedSigner
|
||||||
}
|
}
|
||||||
// If we're amongst the recent signers, wait for the next block
|
// // If we're amongst the recent signers, wait for the next block
|
||||||
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 doesn't shift it out
|
// // 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 {
|
// if limit := uint64(len(snap.Signers)/2 + 1); number < limit || seen > number-limit {
|
||||||
return errors.New("signed recently, must wait for others")
|
// return errors.New("signed recently, must wait for others")
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
// Sweet, the protocol permits us to sign the block, wait for our time
|
// Sweet, the protocol permits us to sign the block, wait for our time
|
||||||
delay := time.UnixMilli(int64(header.Time)).Sub(time.Now()) // nolint: gosimple
|
delay := time.UnixMilli(int64(header.Time)).Sub(time.Now()) // nolint: gosimple
|
||||||
if header.Difficulty.Cmp(diffNoTurn) == 0 {
|
if header.Difficulty.Cmp(diffNoTurn) == 0 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue