Skip to content

Commit

Permalink
queryLatestBlock in getBlocksDelay
Browse files Browse the repository at this point in the history
  • Loading branch information
defi-dev committed Aug 9, 2024
1 parent 2a16133 commit d034447
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions app/dataSources/SubgraphSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ export class SubgraphSource extends AbstractSource {

async getBlocksDelay(): Promise<{ diff: bigint; nodeBlockNumber: bigint; sourceBlockNumber: bigint }> {
const [latestBock, { _meta }] = await Promise.all([
this.network.getLatestBlockNumber(),
this.network.queryLatestBlock().then(b => BigInt(b.number.toString())),
this.query(this.subgraphUrl, QUERY_META),
]);
return {
diff: BigInt(latestBock) - BigInt(_meta.block.number),
nodeBlockNumber: BigInt(latestBock),
sourceBlockNumber: BigInt(latestBock),
diff: latestBock - BigInt(_meta.block.number),
nodeBlockNumber: latestBock,
sourceBlockNumber: latestBock,
};
}

Expand Down
8 changes: 4 additions & 4 deletions app/dataSources/SubquerySource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ export class SubquerySource extends SubgraphSource {

async getBlocksDelay(): Promise<{ diff: bigint; nodeBlockNumber: bigint; sourceBlockNumber: bigint }> {
const [latestBock, { _metadata }] = await Promise.all([
this.network.getLatestBlockNumber(),
this.network.queryLatestBlock().then(b => BigInt(b.number.toString())),
this.query(this.subgraphUrl, QUERY_META),
]);
return {
diff: BigInt(latestBock) - BigInt(_metadata.lastProcessedHeight),
nodeBlockNumber: BigInt(latestBock),
sourceBlockNumber: BigInt(latestBock),
diff: latestBock - BigInt(_metadata.lastProcessedHeight),
nodeBlockNumber: latestBock,
sourceBlockNumber: latestBock,
};
}

Expand Down

0 comments on commit d034447

Please sign in to comment.