Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions consensus/XDPoS/engines/engine_v1/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions consensus/XDPoS/engines/engine_v2/verifyHeader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
8 changes: 4 additions & 4 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down