diff options
author | gary rong <garyrong0905@gmail.com> | 2017-11-24 22:10:27 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-11-24 22:10:27 +0800 |
commit | f14047dae57aa69e4fa08d57e19ee9c0283dfa54 (patch) | |
tree | b1b9523a4ce12e2b3cc472bdcf38df7ddbd4bdcc /consensus/ethash/consensus.go | |
parent | b0056f5bd096adf42a2c28cd76264f230c7cae20 (diff) | |
download | go-tangerine-f14047dae57aa69e4fa08d57e19ee9c0283dfa54.tar go-tangerine-f14047dae57aa69e4fa08d57e19ee9c0283dfa54.tar.gz go-tangerine-f14047dae57aa69e4fa08d57e19ee9c0283dfa54.tar.bz2 go-tangerine-f14047dae57aa69e4fa08d57e19ee9c0283dfa54.tar.lz go-tangerine-f14047dae57aa69e4fa08d57e19ee9c0283dfa54.tar.xz go-tangerine-f14047dae57aa69e4fa08d57e19ee9c0283dfa54.tar.zst go-tangerine-f14047dae57aa69e4fa08d57e19ee9c0283dfa54.zip |
cmd, consensus, eth: split ethash related config to it own (#15520)
* cmd, consensus, eth: split ethash related config to it own
* eth, consensus: minor polish
* eth, consenus, console: compress pow testing config field to single one
* consensus, eth: document pow mode
Diffstat (limited to 'consensus/ethash/consensus.go')
-rw-r--r-- | consensus/ethash/consensus.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/consensus/ethash/consensus.go b/consensus/ethash/consensus.go index e330b7ce5..775419e06 100644 --- a/consensus/ethash/consensus.go +++ b/consensus/ethash/consensus.go @@ -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()) |