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

[3/15 BorHeimdall] header not found: 56300000 #10471

Merged
merged 4 commits into from
May 27, 2024
Merged
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
35 changes: 6 additions & 29 deletions turbo/snapshotsync/freezeblocks/block_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,38 +355,18 @@ func (r *BlockReader) HeadersRange(ctx context.Context, walker func(header *type
return ForEachHeader(ctx, r.sn, walker)
}

func (r *BlockReader) LastNonCanonicalHeaderNumber(ctx context.Context, tx kv.Getter) {

}

func (r *BlockReader) HeaderByNumber(ctx context.Context, tx kv.Getter, blockHeight uint64) (h *types.Header, err error) {
//TODO: investigate why code blolow causing getting error `Could not set forkchoice app=caplin stage=ForkChoice err="execution Client RPC failed to retrieve ForkChoiceUpdate response, err: unknown ancestor"`
//maxBlockNumInFiles := r.sn.BlocksAvailable()
//if maxBlockNumInFiles == 0 || blockHeight > maxBlockNumInFiles {
// if tx == nil {
// return nil, nil
// }
// blockHash, err := rawdb.ReadCanonicalHash(tx, blockHeight)
// if err != nil {
// return nil, err
// }
// if blockHash == (common.Hash{}) {
// return nil, nil
// }
// h = rawdb.ReadHeader(tx, blockHash, blockHeight)
// return h, nil
//}
if tx != nil {
blockHash, err := rawdb.ReadCanonicalHash(tx, blockHeight)
if err != nil {
return nil, err
}
if blockHash == (common.Hash{}) {
return nil, nil
}
h = rawdb.ReadHeader(tx, blockHash, blockHeight)
if h != nil {
return h, nil
// if no canonical marker - still can try read from files
if blockHash != emptyHash {
h = rawdb.ReadHeader(tx, blockHash, blockHeight)
if h != nil {
return h, nil
}
}
}

Expand Down Expand Up @@ -1102,9 +1082,6 @@ func (r *BlockReader) BlockByNumber(ctx context.Context, db kv.Tx, number uint64
if err != nil {
return nil, fmt.Errorf("failed ReadCanonicalHash: %w", err)
}
if hash == (common.Hash{}) {
return nil, nil
}
block, _, err := r.BlockWithSenders(ctx, db, hash, number)
return block, err
}
Expand Down
Loading