Skip to content

Commit 1e03b6c

Browse files
committed
calcTIme+1
1 parent ff0fa92 commit 1e03b6c

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

consensus/system_contract/consensus.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,15 +226,23 @@ func (s *SystemContract) VerifyUncles(chain consensus.ChainReader, block *types.
226226
}
227227

228228
func (s *SystemContract) CalcTimestamp(parent *types.Header) uint64 {
229-
timestamp := parent.Time + s.config.Period
229+
timestamp := parent.Time
230230

231-
// If RelaxedPeriod is enabled, always set the header timestamp to now (ie the time we start building it) as
232-
// we don't know when it will be sealed
233-
if s.config.RelaxedPeriod || timestamp < uint64(time.Now().Unix()) {
234-
timestamp = uint64(time.Now().Unix())
231+
if parent.Number.Uint64()%2 == 0 {
232+
timestamp += 1
235233
}
236234

237235
return timestamp
236+
237+
//timestamp := parent.Time + s.config.Period
238+
//
239+
//// If RelaxedPeriod is enabled, always set the header timestamp to now (ie the time we start building it) as
240+
//// we don't know when it will be sealed
241+
//if s.config.RelaxedPeriod || timestamp < uint64(time.Now().Unix()) {
242+
// timestamp = uint64(time.Now().Unix())
243+
//}
244+
//
245+
//return timestamp
238246
}
239247

240248
// Prepare initializes the consensus fields of a block header according to the

0 commit comments

Comments
 (0)