Use uint64 for block header timestamp

This commit is contained in:
Gustav Simonsson
2015-06-30 09:13:16 +02:00
parent be935bff84
commit 4c490db6af
12 changed files with 24 additions and 25 deletions

View File

@ -368,8 +368,8 @@ func (self *worker) commitNewWork() {
tstart := time.Now()
parent := self.chain.CurrentBlock()
tstamp := tstart.Unix()
if tstamp <= parent.Time() {
tstamp = parent.Time() + 1
if tstamp <= int64(parent.Time()) {
tstamp = int64(parent.Time()) + 1
}
// this will ensure we're not going off too far in the future
if now := time.Now().Unix(); tstamp > now+4 {
@ -382,7 +382,7 @@ func (self *worker) commitNewWork() {
header := &types.Header{
ParentHash: parent.Hash(),
Number: num.Add(num, common.Big1),
Difficulty: core.CalcDifficulty(tstamp, parent.Time(), parent.Difficulty()),
Difficulty: core.CalcDifficulty(int64(tstamp), int64(parent.Time()), parent.Difficulty()),
GasLimit: core.CalcGasLimit(parent),
GasUsed: new(big.Int),
Coinbase: self.coinbase,