aboutsummaryrefslogtreecommitdiffstats
path: root/consensus
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-12-14 17:28:42 +0800
committerGitHub <noreply@github.com>2017-12-14 17:28:42 +0800
commit5129ef22c2aaa3e8c733fe7c0fb6eff64457426c (patch)
treed06c8293010602153161c6e718b40e04eae2312f /consensus
parent3654aeaa4f87452ac5bc801a18808189595e2ef8 (diff)
parent79d5e5593fc86190a5f67d9c48b3de365075c9cd (diff)
downloadgo-tangerine-5129ef22c2aaa3e8c733fe7c0fb6eff64457426c.tar
go-tangerine-5129ef22c2aaa3e8c733fe7c0fb6eff64457426c.tar.gz
go-tangerine-5129ef22c2aaa3e8c733fe7c0fb6eff64457426c.tar.bz2
go-tangerine-5129ef22c2aaa3e8c733fe7c0fb6eff64457426c.tar.lz
go-tangerine-5129ef22c2aaa3e8c733fe7c0fb6eff64457426c.tar.xz
go-tangerine-5129ef22c2aaa3e8c733fe7c0fb6eff64457426c.tar.zst
go-tangerine-5129ef22c2aaa3e8c733fe7c0fb6eff64457426c.zip
Merge pull request #15629 from holiman/relax_futuretime
consensus/ethash: relax requirements when determining future-blocks
Diffstat (limited to 'consensus')
-rw-r--r--consensus/ethash/consensus.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/consensus/ethash/consensus.go b/consensus/ethash/consensus.go
index 775419e06..2bdb18677 100644
--- a/consensus/ethash/consensus.go
+++ b/consensus/ethash/consensus.go
@@ -36,9 +36,10 @@ import (
// Ethash proof-of-work protocol constants.
var (
- FrontierBlockReward *big.Int = big.NewInt(5e+18) // Block reward in wei for successfully mining a block
- ByzantiumBlockReward *big.Int = big.NewInt(3e+18) // Block reward in wei for successfully mining a block upward from Byzantium
- maxUncles = 2 // Maximum number of uncles allowed in a single block
+ FrontierBlockReward *big.Int = big.NewInt(5e+18) // Block reward in wei for successfully mining a block
+ ByzantiumBlockReward *big.Int = big.NewInt(3e+18) // Block reward in wei for successfully mining a block upward from Byzantium
+ maxUncles = 2 // Maximum number of uncles allowed in a single block
+ allowedFutureBlockTime = 15 * time.Second // Max time from current time allowed for blocks, before they're considered future blocks
)
// Various error messages to mark blocks invalid. These should be private to
@@ -231,7 +232,7 @@ func (ethash *Ethash) verifyHeader(chain consensus.ChainReader, header, parent *
return errLargeBlockTime
}
} else {
- if header.Time.Cmp(big.NewInt(time.Now().Unix())) > 0 {
+ if header.Time.Cmp(big.NewInt(time.Now().Add(allowedFutureBlockTime).Unix())) > 0 {
return consensus.ErrFutureBlock
}
}