Skip to content

Commit

Permalink
fix(ClientHelper): Use latest searched HubPoolClient block instead of…
Browse files Browse the repository at this point in the history
… eventSearchConfig.toBlock (#1127)

across-protocol/sdk#475 resets the eventSearchConfig.toBlock to undefined after the update so we shouldn't read it directly
  • Loading branch information
nicholaspai authored Dec 20, 2023
1 parent fc41922 commit d0dc4ec
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/common/ClientHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,7 @@ export async function constructSpokePoolClientsWithStartBlocks(

// Explicitly set toBlocks for all chains so we can re-use them in other clients to make sure they all query
// state to the same "latest" block per chain.
if (hubPoolClient.eventSearchConfig.toBlock === undefined) {
throw new Error("HubPoolClient eventSearchConfig.toBlock is undefined");
}
const hubPoolBlock = await hubPoolClient.hubPool.provider.getBlock(hubPoolClient.eventSearchConfig.toBlock);
const hubPoolBlock = await hubPoolClient.hubPool.provider.getBlock(hubPoolClient.latestBlockSearched);
const latestBlocksForChain: Record<number, number> = Object.fromEntries(
await Promise.all(
enabledChains.map(async (chainId) => {
Expand Down

0 comments on commit d0dc4ec

Please sign in to comment.