diff options
Diffstat (limited to 'consensus/ethash/consensus.go')
-rw-r--r-- | consensus/ethash/consensus.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/consensus/ethash/consensus.go b/consensus/ethash/consensus.go index 6a19d449f..775419e06 100644 --- a/consensus/ethash/consensus.go +++ b/consensus/ethash/consensus.go @@ -36,8 +36,8 @@ 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 + 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 ) @@ -68,7 +68,7 @@ func (ethash *Ethash) Author(header *types.Header) (common.Address, error) { // stock Ethereum ethash engine. func (ethash *Ethash) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error { // If we're running a full engine faking, accept any input as valid - if ethash.fakeFull { + if ethash.config.PowMode == ModeFullFake { return nil } // Short circuit if the header is known, or it's parent not @@ -89,7 +89,7 @@ func (ethash *Ethash) VerifyHeader(chain consensus.ChainReader, header *types.He // a results channel to retrieve the async verifications. func (ethash *Ethash) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error) { // If we're running a full engine faking, accept any input as valid - if ethash.fakeFull || len(headers) == 0 { + if ethash.config.PowMode == ModeFullFake || len(headers) == 0 { abort, results := make(chan struct{}), make(chan error, len(headers)) for i := 0; i < len(headers); i++ { results <- nil @@ -169,7 +169,7 @@ func (ethash *Ethash) verifyHeaderWorker(chain consensus.ChainReader, headers [] // rules of the stock Ethereum ethash engine. func (ethash *Ethash) VerifyUncles(chain consensus.ChainReader, block *types.Block) error { // If we're running a full engine faking, accept any input as valid - if ethash.fakeFull { + if ethash.config.PowMode == ModeFullFake { return nil } // Verify that there are at most 2 uncles included in this block @@ -455,7 +455,7 @@ func calcDifficultyFrontier(time uint64, parent *types.Header) *big.Int { // the PoW difficulty requirements. func (ethash *Ethash) VerifySeal(chain consensus.ChainReader, header *types.Header) error { // If we're running a fake PoW, accept any seal as valid - if ethash.fakeMode { + if ethash.config.PowMode == ModeFake || ethash.config.PowMode == ModeFullFake { time.Sleep(ethash.fakeDelay) if ethash.fakeFail == header.Number.Uint64() { return errInvalidPoW @@ -480,7 +480,7 @@ func (ethash *Ethash) VerifySeal(chain consensus.ChainReader, header *types.Head cache := ethash.cache(number) size := datasetSize(number) - if ethash.tester { + if ethash.config.PowMode == ModeTest { size = 32 * 1024 } digest, result := hashimotoLight(size, cache, header.HashNoNonce().Bytes(), header.Nonce.Uint64()) @@ -529,9 +529,9 @@ var ( // TODO (karalabe): Move the chain maker into this package and make this private! func AccumulateRewards(config *params.ChainConfig, state *state.StateDB, header *types.Header, uncles []*types.Header) { // Select the correct block reward based on chain progression - blockReward := frontierBlockReward + blockReward := FrontierBlockReward if config.IsByzantium(header.Number) { - blockReward = byzantiumBlockReward + blockReward = ByzantiumBlockReward } // Accumulate the rewards for the miner and any included uncles reward := new(big.Int).Set(blockReward) |