aboutsummaryrefslogtreecommitdiffstats
path: root/miner/worker.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-08-25 21:49:36 +0800
committerGustav Simonsson <gustav.simonsson@gmail.com>2015-08-25 21:54:57 +0800
commitfd512fa12c59657d9e47cc3411e6e24bd1af89cb (patch)
tree16ddada3b6ecbf26e53bb9eaf0c8b03812f7cab8 /miner/worker.go
parentdc3fb69dce674069479313837a5612045303c418 (diff)
downloadgo-tangerine-1.1.0.tar
go-tangerine-1.1.0.tar.gz
go-tangerine-1.1.0.tar.bz2
go-tangerine-1.1.0.tar.lz
go-tangerine-1.1.0.tar.xz
go-tangerine-1.1.0.tar.zst
go-tangerine-1.1.0.zip
Merge pull request #1711 from Gustav-Simonsson/timestamp_big_intv1.1.0
Add tests for uncle timestamps and refactor timestamp type (cherry picked from commit abce09954b6901b446c004ee06b389c338922f28)
Diffstat (limited to 'miner/worker.go')
-rw-r--r--miner/worker.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/miner/worker.go b/miner/worker.go
index aa2132a51..86970ec07 100644
--- a/miner/worker.go
+++ b/miner/worker.go
@@ -278,7 +278,7 @@ func (self *worker) wait() {
glog.V(logger.Error).Infoln("Invalid block found during mining")
continue
}
- if err := core.ValidateHeader(self.eth.BlockProcessor().Pow, block.Header(), parent, true); err != nil && err != core.BlockFutureErr {
+ if err := core.ValidateHeader(self.eth.BlockProcessor().Pow, block.Header(), parent, true, false); err != nil && err != core.BlockFutureErr {
glog.V(logger.Error).Infoln("Invalid header on mined block:", err)
continue
}
@@ -434,8 +434,8 @@ func (self *worker) commitNewWork() {
tstart := time.Now()
parent := self.chain.CurrentBlock()
tstamp := tstart.Unix()
- if tstamp <= int64(parent.Time()) {
- tstamp = int64(parent.Time()) + 1
+ if parent.Time().Cmp(new(big.Int).SetInt64(tstamp)) != 1 {
+ tstamp = parent.Time().Int64() + 1
}
// this will ensure we're not going off too far in the future
if now := time.Now().Unix(); tstamp > now+4 {
@@ -448,12 +448,12 @@ func (self *worker) commitNewWork() {
header := &types.Header{
ParentHash: parent.Hash(),
Number: num.Add(num, common.Big1),
- Difficulty: core.CalcDifficulty(uint64(tstamp), parent.Time(), parent.Number(), parent.Difficulty()),
+ Difficulty: core.CalcDifficulty(uint64(tstamp), parent.Time().Uint64(), parent.Number(), parent.Difficulty()),
GasLimit: core.CalcGasLimit(parent),
GasUsed: new(big.Int),
Coinbase: self.coinbase,
Extra: self.extra,
- Time: uint64(tstamp),
+ Time: big.NewInt(tstamp),
}
previous := self.current