aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Jentzsch <jentzsch.software@gmail.com>2015-09-03 05:24:17 +0800
committerCJentzsch <jentzsch.software@gmail.com>2015-09-03 06:05:05 +0800
commit0fda4c4e1556671e2a2cdc1561fa9b8fe643eed5 (patch)
tree7bb324bd4b7a2cdfd12d6faba074a276bacaa9be
parentb2c17a5a63da692accb1d047e0944d4d79546db5 (diff)
downloadgo-tangerine-0fda4c4e1556671e2a2cdc1561fa9b8fe643eed5.tar
go-tangerine-0fda4c4e1556671e2a2cdc1561fa9b8fe643eed5.tar.gz
go-tangerine-0fda4c4e1556671e2a2cdc1561fa9b8fe643eed5.tar.bz2
go-tangerine-0fda4c4e1556671e2a2cdc1561fa9b8fe643eed5.tar.lz
go-tangerine-0fda4c4e1556671e2a2cdc1561fa9b8fe643eed5.tar.xz
go-tangerine-0fda4c4e1556671e2a2cdc1561fa9b8fe643eed5.tar.zst
go-tangerine-0fda4c4e1556671e2a2cdc1561fa9b8fe643eed5.zip
fix block time issue
currently, under normal circumstances, you always set the timestamp to previous.Time() + 1. credits to https://www.reddit.com/r/ethereum/comments/3jcs5r/code_avg_block_time_vs_difficulty_adjustment/cuoi4op style
-rw-r--r--miner/worker.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/miner/worker.go b/miner/worker.go
index 86970ec07..16a16931d 100644
--- a/miner/worker.go
+++ b/miner/worker.go
@@ -434,7 +434,7 @@ func (self *worker) commitNewWork() {
tstart := time.Now()
parent := self.chain.CurrentBlock()
tstamp := tstart.Unix()
- if parent.Time().Cmp(new(big.Int).SetInt64(tstamp)) != 1 {
+ if parent.Time().Cmp(new(big.Int).SetInt64(tstamp)) >= 0 {
tstamp = parent.Time().Int64() + 1
}
// this will ensure we're not going off too far in the future