Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RpcDaemon doesn't see recently retired blocks #9318

Merged
merged 17 commits into from
Jan 29, 2024
Prev Previous commit
Next Next commit
save
  • Loading branch information
AskAlexSharov committed Jan 26, 2024
commit 743a2ca647bcc5adc4eeb7fd4a8537ab2d6a3932
8 changes: 8 additions & 0 deletions turbo/snapshotsync/freezeblocks/block_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,13 +504,15 @@ func (r *BlockReader) blockWithSenders(ctx context.Context, tx kv.Getter, hash c
}

if r.sn == nil {
log.Warn("[dbg] blockWithSenders1", "blockHeight", blockHeight)
return
}

view := r.sn.View()
defer view.Close()
seg, ok := view.HeadersSegment(blockHeight)
if !ok {
log.Warn("[dbg] blockWithSenders2", "blockHeight", blockHeight)
return
}

Expand All @@ -520,6 +522,7 @@ func (r *BlockReader) blockWithSenders(ctx context.Context, tx kv.Getter, hash c
return nil, nil, err
}
if h == nil {
log.Warn("[dbg] blockWithSenders3", "blockHeight", blockHeight)
return
}

Expand All @@ -528,13 +531,15 @@ func (r *BlockReader) blockWithSenders(ctx context.Context, tx kv.Getter, hash c
var txsAmount uint32
bodySeg, ok := view.BodiesSegment(blockHeight)
if !ok {
log.Warn("[dbg] blockWithSenders4", "blockHeight", blockHeight)
return
}
b, baseTxnId, txsAmount, buf, err = r.bodyFromSnapshot(blockHeight, bodySeg, buf)
if err != nil {
return nil, nil, err
}
if b == nil {
log.Warn("[dbg] blockWithSenders5", "blockHeight", blockHeight)
return
}
if txsAmount == 0 {
Expand All @@ -548,14 +553,17 @@ func (r *BlockReader) blockWithSenders(ctx context.Context, tx kv.Getter, hash c

txnSeg, ok := view.TxsSegment(blockHeight)
if !ok {
log.Warn("[dbg] blockWithSenders6", "blockHeight", blockHeight)
return
}
var txs []types.Transaction
txs, senders, err = r.txsFromSnapshot(baseTxnId, txsAmount, txnSeg, buf)
if err != nil {
log.Warn("[dbg] blockWithSenders7", "blockHeight", blockHeight)
return nil, nil, err
}
if !ok {
log.Warn("[dbg] blockWithSenders8", "blockHeight", blockHeight)
return
}
block = types.NewBlockFromStorage(hash, h, txs, b.Uncles, b.Withdrawals)
Expand Down
Loading