From e977be73da54e2f637138c9b60b16aaa2813cbc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20=C5=BDivkovi=C4=87?= Date: Wed, 10 Aug 2022 13:53:06 +0200 Subject: [PATCH] Make the header timestamp respect time of generation (#678) --- consensus/ibft/consensus_backend.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/consensus/ibft/consensus_backend.go b/consensus/ibft/consensus_backend.go index 46cd875643..e2f4dd00b3 100644 --- a/consensus/ibft/consensus_backend.go +++ b/consensus/ibft/consensus_backend.go @@ -136,14 +136,7 @@ func (i *backendIBFT) buildBlock(snap *Snapshot, parent *types.Header) (*types.B } // set the timestamp - parentTime := time.Unix(int64(parent.Timestamp), 0) - headerTime := parentTime.Add(i.blockTime) - - if headerTime.Before(time.Now()) { - headerTime = time.Now() - } - - header.Timestamp = uint64(headerTime.Unix()) + header.Timestamp = uint64(time.Now().Unix()) // we need to include in the extra field the current set of validators putIbftExtraValidators(header, snap.Set)