mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
try fix for setHead
This commit is contained in:
parent
d4b106c978
commit
60e7867bcd
1 changed files with 9 additions and 5 deletions
|
|
@ -600,11 +600,15 @@ func (bc *BlockChain) SetHead(head uint64) error {
|
||||||
// Send chain head event to update the transaction pool
|
// Send chain head event to update the transaction pool
|
||||||
header := bc.CurrentBlock()
|
header := bc.CurrentBlock()
|
||||||
if block := bc.GetBlock(header.Hash(), header.Number.Uint64()); block == nil {
|
if block := bc.GetBlock(header.Hash(), header.Number.Uint64()); block == nil {
|
||||||
// This should never happen. In practice, previously currentBlock
|
// In a pruned node the genesis block will not exist in the freezer.
|
||||||
// contained the entire block whereas now only a "marker", so there
|
// It should not happen that we set head to any other pruned block.
|
||||||
// is an ever so slight chance for a race we should handle.
|
if header.Number.Uint64() > 0 {
|
||||||
log.Error("Current block not found in database", "block", header.Number, "hash", header.Hash())
|
// This should never happen. In practice, previously currentBlock
|
||||||
return fmt.Errorf("current block missing: #%d [%x..]", header.Number, header.Hash().Bytes()[:4])
|
// contained the entire block whereas now only a "marker", so there
|
||||||
|
// is an ever so slight chance for a race we should handle.
|
||||||
|
log.Error("Current block not found in database", "block", header.Number, "hash", header.Hash())
|
||||||
|
return fmt.Errorf("current block missing: #%d [%x..]", header.Number, header.Hash().Bytes()[:4])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
bc.chainHeadFeed.Send(ChainHeadEvent{Header: header})
|
bc.chainHeadFeed.Send(ChainHeadEvent{Header: header})
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue