mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-08 07:58:40 +00:00
try fix
This commit is contained in:
parent
052a24c353
commit
5c101bba03
3 changed files with 15 additions and 1 deletions
|
|
@ -251,7 +251,7 @@ func (db *CachingDB) ReaderEIP7928(stateRoot common.Hash, accessList map[common.
|
||||||
// Construct the state reader with background prefetching
|
// Construct the state reader with background prefetching
|
||||||
pr := newPrefetchStateReader(r, accessList, threads)
|
pr := newPrefetchStateReader(r, accessList, threads)
|
||||||
|
|
||||||
return newReader(db.codedb.Reader(), pr), nil
|
return newReaderWithPrefetch(db.codedb.Reader(), pr, pr), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// OpenTrie opens the main account trie at a specific root hash.
|
// OpenTrie opens the main account trie at a specific root hash.
|
||||||
|
|
|
||||||
|
|
@ -529,6 +529,7 @@ func (r *stateReaderWithStats) GetStateStats() StateReaderStats {
|
||||||
type reader struct {
|
type reader struct {
|
||||||
ContractCodeReader
|
ContractCodeReader
|
||||||
StateReader
|
StateReader
|
||||||
|
PrefetcherMetricer
|
||||||
}
|
}
|
||||||
|
|
||||||
// newReader constructs a reader with the supplied code reader and state reader.
|
// newReader constructs a reader with the supplied code reader and state reader.
|
||||||
|
|
@ -539,6 +540,14 @@ func newReader(codeReader ContractCodeReader, stateReader StateReader) *reader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func newReaderWithPrefetch(codeReader ContractCodeReader, stateReader StateReader, metricer PrefetcherMetricer) *reader {
|
||||||
|
return &reader{
|
||||||
|
ContractCodeReader: codeReader,
|
||||||
|
StateReader: stateReader,
|
||||||
|
PrefetcherMetricer: metricer,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// GetCodeStats returns the statistics of code access.
|
// GetCodeStats returns the statistics of code access.
|
||||||
func (r *reader) GetCodeStats() ContractCodeReaderStats {
|
func (r *reader) GetCodeStats() ContractCodeReaderStats {
|
||||||
if stater, ok := r.ContractCodeReader.(ContractCodeReaderStater); ok {
|
if stater, ok := r.ContractCodeReader.(ContractCodeReaderStater); ok {
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,11 @@ func newPrefetchStateReaderInternal(reader StateReader, tasks []*fetchTask, nThr
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *prefetchStateReader) Metrics() PrefetchMetrics {
|
||||||
|
// TODO (jwasinger) actually implement this
|
||||||
|
return PrefetchMetrics{}
|
||||||
|
}
|
||||||
|
|
||||||
func (r *prefetchStateReader) Close() {
|
func (r *prefetchStateReader) Close() {
|
||||||
r.closeOnce.Do(func() {
|
r.closeOnce.Do(func() {
|
||||||
close(r.term)
|
close(r.term)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue