Skip to content

Commit

Permalink
Fixed panic on new mined block event when block download is disabled (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
eastorski authored Feb 18, 2025
1 parent b2ee8b6 commit e941501
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -889,14 +889,16 @@ func New(ctx context.Context, stack *node.Node, config *ethconfig.Config, logger
for {
select {
case b := <-backend.minedBlocks:
// Add mined header and block body before broadcast. This is because the broadcast call
// will trigger the staged sync which will require headers and blocks to be available
// in their respective cache in the download stage. If not found, it would cause a
// liveness issue for the chain.
if err := backend.sentriesClient.Hd.AddMinedHeader(b.Header()); err != nil {
logger.Error("add mined block to header downloader", "err", err)
if !sentryMcDisableBlockDownload {
// Add mined header and block body before broadcast. This is because the broadcast call
// will trigger the staged sync which will require headers and blocks to be available
// in their respective cache in the download stage. If not found, it would cause a
// liveness issue for the chain.
if err := backend.sentriesClient.Hd.AddMinedHeader(b.Header()); err != nil {
logger.Error("add mined block to header downloader", "err", err)
}
backend.sentriesClient.Bd.AddToPrefetch(b.Header(), b.RawBody())
}
backend.sentriesClient.Bd.AddToPrefetch(b.Header(), b.RawBody())

//p2p
//backend.sentriesClient.BroadcastNewBlock(context.Background(), b, b.Difficulty())
Expand Down

0 comments on commit e941501

Please sign in to comment.