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

trace read parent header from snapshot and lru #4042

Merged
merged 1 commit into from
May 1, 2022
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
16 changes: 13 additions & 3 deletions cmd/rpcdaemon/commands/trace_adhoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/ledgerwatch/erigon/common/hexutil"
math2 "github.com/ledgerwatch/erigon/common/math"
"github.com/ledgerwatch/erigon/core"
"github.com/ledgerwatch/erigon/core/rawdb"
"github.com/ledgerwatch/erigon/core/state"
"github.com/ledgerwatch/erigon/core/types"
"github.com/ledgerwatch/erigon/core/types/accounts"
Expand Down Expand Up @@ -1034,7 +1033,13 @@ func (api *TraceAPIImpl) CallMany(ctx context.Context, calls json.RawMessage, pa
if err != nil {
return nil, err
}
parentHeader := rawdb.ReadHeader(dbtx, hash, blockNumber)

// TODO: can read here only parent header
parentBlock, err := api.blockWithSenders(dbtx, hash, blockNumber)
if err != nil {
return nil, err
}
parentHeader := parentBlock.Header()
if parentHeader == nil {
return nil, fmt.Errorf("parent header %d(%x) not found", blockNumber, hash)
}
Expand Down Expand Up @@ -1085,7 +1090,12 @@ func (api *TraceAPIImpl) doCallMany(ctx context.Context, dbtx kv.Tx, msgs []type
noop := state.NewNoopWriter()
cachedWriter := state.NewCachedWriter(noop, stateCache)

parentHeader := rawdb.ReadHeader(dbtx, hash, blockNumber)
// TODO: can read here only parent header
parentBlock, err := api.blockWithSenders(dbtx, hash, blockNumber)
if err != nil {
return nil, err
}
parentHeader := parentBlock.Header()
if parentHeader == nil {
return nil, fmt.Errorf("parent header %d(%x) not found", blockNumber, hash)
}
Expand Down