diff --git a/consensus/XDPoS/engines/engine_v1/engine.go b/consensus/XDPoS/engines/engine_v1/engine.go index d7b3c2c8b70..2e30722cd8d 100644 --- a/consensus/XDPoS/engines/engine_v1/engine.go +++ b/consensus/XDPoS/engines/engine_v1/engine.go @@ -134,8 +134,8 @@ func (x *XDPoS_v1) VerifyHeaders(chain consensus.ChainReader, headers []*types.H } func (x *XDPoS_v1) verifyHeaderWithCache(chain consensus.ChainReader, header *types.Header, parents []*types.Header, fullVerify bool) error { - _, check := x.verifiedHeaders.Get(header.Hash()) - if check { + _, ok := x.verifiedHeaders.Get(header.Hash()) + if ok { return nil } err := x.verifyHeader(chain, header, parents, fullVerify) diff --git a/consensus/XDPoS/engines/engine_v2/verifyHeader.go b/consensus/XDPoS/engines/engine_v2/verifyHeader.go index 20f18cbe059..f9b9971066d 100644 --- a/consensus/XDPoS/engines/engine_v2/verifyHeader.go +++ b/consensus/XDPoS/engines/engine_v2/verifyHeader.go @@ -29,8 +29,8 @@ func (x *XDPoS_v2) verifyHeader(chain consensus.ChainReader, header *types.Heade } } - _, check := x.verifiedHeaders.Get(header.Hash()) - if check { + _, ok := x.verifiedHeaders.Get(header.Hash()) + if ok { return nil } diff --git a/core/blockchain.go b/core/blockchain.go index 3747a087a7a..874fa1a64c3 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -2068,11 +2068,11 @@ func (bc *BlockChain) InsertBlock(block *types.Block) error { func (bc *BlockChain) PrepareBlock(block *types.Block) (err error) { defer log.Debug("Done prepare block ", "number", block.NumberU64(), "hash", block.Hash(), "validator", block.Header().Validator, "err", err) - if _, check := bc.resultProcess.Get(block.Hash()); check { + if _, ok := bc.resultProcess.Get(block.Hash()); ok { log.Debug("Stop prepare a block because the result cached", "number", block.NumberU64(), "hash", block.Hash(), "validator", block.Header().Validator) return nil } - if _, check := bc.calculatingBlock.Get(block.Hash()); check { + if _, ok := bc.calculatingBlock.Get(block.Hash()); ok { log.Debug("Stop prepare a block because inserting", "number", block.NumberU64(), "hash", block.Hash(), "validator", block.Header().Validator) return nil } @@ -2096,7 +2096,7 @@ func (bc *BlockChain) PrepareBlock(block *types.Block) (err error) { func (bc *BlockChain) getResultBlock(block *types.Block, verifiedM2 bool) (*ResultProcessBlock, error) { var calculatedBlock *CalculatedBlock if verifiedM2 { - if result, check := bc.resultProcess.Get(block.HashNoValidator()); check { + if result, ok := bc.resultProcess.Get(block.HashNoValidator()); ok { log.Debug("Get result block from cache ", "number", block.NumberU64(), "hash", block.Hash(), "hash no validator", block.HashNoValidator()) return result, nil } @@ -2223,7 +2223,7 @@ func (bc *BlockChain) insertBlock(block *types.Block) ([]interface{}, []*types.L events = make([]interface{}, 0, 1) coalescedLogs []*types.Log ) - if _, check := bc.downloadingBlock.Get(block.Hash()); check { + if _, ok := bc.downloadingBlock.Get(block.Hash()); ok { log.Debug("Stop fetcher a block because downloading", "number", block.NumberU64(), "hash", block.Hash()) return events, coalescedLogs, nil }