Skip to content

Commit

Permalink
Fix headState does not exist (#4944)
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths authored Dec 24, 2022
1 parent c1b6e83 commit d7f0168
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,11 @@ export class StateContextCache {

get(rootHex: RootHex): CachedBeaconStateAllForks | null {
this.metrics?.lookups.inc();
const item = this.cache.get(rootHex);
const item = this.head?.stateRoot === rootHex ? this.head.state : this.cache.get(rootHex);
if (!item) {
return null;
}

if (this.head?.stateRoot === rootHex) {
return this.head.state;
}

this.metrics?.hits.inc();
this.metrics?.stateClonedCount.observe(item.clonedCount);

Expand Down

0 comments on commit d7f0168

Please sign in to comment.