mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-31 09:03:46 +00:00
params,consensus/ethash,miner: move parameter maxUncles from ethash to params,to avoid magic number
This commit is contained in:
parent
0ff35e170d
commit
604f0b3a20
3 changed files with 3 additions and 3 deletions
|
|
@ -37,7 +37,6 @@ import (
|
|||
// Ethash proof-of-work protocol constants.
|
||||
var (
|
||||
blockReward *big.Int = big.NewInt(5e+18) // Block reward in wei for successfully mining a block
|
||||
maxUncles = 2 // Maximum number of uncles allowed in a single block
|
||||
)
|
||||
|
||||
// Various error messages to mark blocks invalid. These should be private to
|
||||
|
|
@ -172,7 +171,7 @@ func (ethash *Ethash) VerifyUncles(chain consensus.ChainReader, block *types.Blo
|
|||
return nil
|
||||
}
|
||||
// Verify that there are at most 2 uncles included in this block
|
||||
if len(block.Uncles()) > maxUncles {
|
||||
if len(block.Uncles()) > params.MaxUncles {
|
||||
return errTooManyUncles
|
||||
}
|
||||
// Gather the set of past uncles and ancestors
|
||||
|
|
|
|||
|
|
@ -452,7 +452,7 @@ func (self *worker) commitNewWork() {
|
|||
badUncles []common.Hash
|
||||
)
|
||||
for hash, uncle := range self.possibleUncles {
|
||||
if len(uncles) == 2 {
|
||||
if len(uncles) == params.MaxUncles {
|
||||
break
|
||||
}
|
||||
if err := self.commitUncle(work, uncle.Header()); err != nil {
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ const (
|
|||
MemoryGas uint64 = 3 // Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL.
|
||||
TxDataNonZeroGas uint64 = 68 // Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions.
|
||||
|
||||
MaxUncles = 2 // Maximum number of uncles allowed in a single block
|
||||
MaxCodeSize = 24576
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue