From 091e92d79c8719d33ee864684ff9116dafbe3aa1 Mon Sep 17 00:00:00 2001 From: Kartik Chopra Date: Mon, 26 Aug 2024 12:48:14 -0400 Subject: [PATCH] feat: allow recents --- consensus/clique/clique.go | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/consensus/clique/clique.go b/consensus/clique/clique.go index ecf5be129c..2924d4c5c2 100644 --- a/consensus/clique/clique.go +++ b/consensus/clique/clique.go @@ -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 {