Skip to content

Commit 5129ef2

Browse files
authored
Merge pull request #15629 from holiman/relax_futuretime
consensus/ethash: relax requirements when determining future-blocks
2 parents 3654aea + 79d5e55 commit 5129ef2

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎consensus/ethash/consensus.go‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ import (
3636

3737
// Ethash proof-of-work protocol constants.
3838
var (
39-
FrontierBlockReward *big.Int = big.NewInt(5e+18) // Block reward in wei for successfully mining a block
40-
ByzantiumBlockReward *big.Int = big.NewInt(3e+18) // Block reward in wei for successfully mining a block upward from Byzantium
41-
maxUncles = 2 // Maximum number of uncles allowed in a single block
39+
FrontierBlockReward *big.Int = big.NewInt(5e+18) // Block reward in wei for successfully mining a block
40+
ByzantiumBlockReward *big.Int = big.NewInt(3e+18) // Block reward in wei for successfully mining a block upward from Byzantium
41+
maxUncles = 2 // Maximum number of uncles allowed in a single block
42+
allowedFutureBlockTime = 15 * time.Second // Max time from current time allowed for blocks, before they're considered future blocks
4243
)
4344

4445
// 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 *
231232
return errLargeBlockTime
232233
}
233234
} else {
234-
if header.Time.Cmp(big.NewInt(time.Now().Unix())) > 0 {
235+
if header.Time.Cmp(big.NewInt(time.Now().Add(allowedFutureBlockTime).Unix())) > 0 {
235236
return consensus.ErrFutureBlock
236237
}
237238
}

0 commit comments

Comments
 (0)