aboutsummaryrefslogtreecommitdiffstats
path: root/consensus/clique
diff options
context:
space:
mode:
Diffstat (limited to 'consensus/clique')
-rw-r--r--consensus/clique/clique.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/consensus/clique/clique.go b/consensus/clique/clique.go
index c79c30cae..a18782474 100644
--- a/consensus/clique/clique.go
+++ b/consensus/clique/clique.go
@@ -279,7 +279,7 @@ func (c *Clique) verifyHeader(chain consensus.ChainReader, header *types.Header,
number := header.Number.Uint64()
// Don't waste time checking blocks from the future
- if header.Time.Cmp(big.NewInt(time.Now().Unix())) > 0 {
+ if header.Time > uint64(time.Now().Unix()) {
return consensus.ErrFutureBlock
}
// Checkpoint blocks need to enforce zero beneficiary
@@ -351,7 +351,7 @@ func (c *Clique) verifyCascadingFields(chain consensus.ChainReader, header *type
if parent == nil || parent.Number.Uint64() != number-1 || parent.Hash() != header.ParentHash {
return consensus.ErrUnknownAncestor
}
- if parent.Time.Uint64()+c.config.Period > header.Time.Uint64() {
+ if parent.Time+c.config.Period > header.Time {
return ErrInvalidTimestamp
}
// Retrieve the snapshot needed to verify this header and cache it
@@ -570,9 +570,9 @@ func (c *Clique) Prepare(chain consensus.ChainReader, header *types.Header) erro
if parent == nil {
return consensus.ErrUnknownAncestor
}
- header.Time = new(big.Int).Add(parent.Time, new(big.Int).SetUint64(c.config.Period))
- if header.Time.Int64() < time.Now().Unix() {
- header.Time = big.NewInt(time.Now().Unix())
+ header.Time = parent.Time + c.config.Period
+ if header.Time < uint64(time.Now().Unix()) {
+ header.Time = uint64(time.Now().Unix())
}
return nil
}
@@ -637,7 +637,7 @@ func (c *Clique) Seal(chain consensus.ChainReader, block *types.Block, results c
}
}
// 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
+ delay := time.Unix(int64(header.Time), 0).Sub(time.Now()) // nolint: gosimple
if header.Difficulty.Cmp(diffNoTurn) == 0 {
// It's not our turn explicitly to sign, delay it a bit
wiggle := time.Duration(len(snap.Signers)/2+1) * wiggleTime