-
Notifications
You must be signed in to change notification settings - Fork 775
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
client: ensure chain head updates correctly
- Loading branch information
1 parent
da48eca
commit 586868b
Showing
1 changed file
with
6 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -294,18 +294,18 @@ export class Chain { | |
height: BIGINT_0, | ||
} | ||
|
||
blocks.latest = await this.getCanonicalHeadBlock() | ||
blocks.finalized = (await this.getCanonicalFinalizedBlock()) ?? null | ||
blocks.safe = (await this.getCanonicalSafeBlock()) ?? null | ||
blocks.vm = await this.getCanonicalVmHead() | ||
|
||
headers.latest = blocks.latest.header | ||
headers.latest = await this.getCanonicalHeadHeader() | ||
// finalized and safe are always blocks since they have to have valid execution | ||
// before they can be saved in chain | ||
headers.finalized = blocks.finalized?.header ?? null | ||
headers.safe = blocks.safe?.header ?? null | ||
headers.vm = (await this.getCanonicalVmHead()).header | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jochem-brouwer
Author
Member
|
||
|
||
blocks.latest = await this.getCanonicalHeadBlock() | ||
blocks.finalized = (await this.getCanonicalFinalizedBlock()) ?? null | ||
blocks.safe = (await this.getCanonicalSafeBlock()) ?? null | ||
blocks.vm = await this.getCanonicalVmHead() | ||
|
||
headers.height = headers.latest.number | ||
blocks.height = blocks.latest.header.number | ||
|
||
|
By switching around headers and blocks assignments, we can assign
headers.vm = blocks.vm.header
and avoid making an extra relatively expensive asynchronous call.