Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,11 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra

/** Runs a query concurrently with a validation that the block hash is not ahead of the anchor block. */
async #queryWithBlockHashNotAfterAnchor<T>(blockHash: BlockHash, query: () => Promise<T>): Promise<T> {
const anchorHash = await this.anchorBlockHeader.hash();
if (blockHash.equals(anchorHash)) {
return query();
}

const [response] = await Promise.all([
query(),
(async () => {
Expand All @@ -1006,7 +1011,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra

if (header.getBlockNumber() > this.anchorBlockHeader.getBlockNumber()) {
throw new Error(
`Made a node query with a reference block hash ${blockHash} with block number ${header.getBlockNumber()}, which is ahead of the anchor block number ${this.anchorBlockHeader.getBlockNumber()} (from anchor block hash ${await this.anchorBlockHeader.hash()}).`,
`Made a node query with a reference block hash ${blockHash} with block number ${header.getBlockNumber()}, which is ahead of the anchor block number ${this.anchorBlockHeader.getBlockNumber()} (from anchor block hash ${anchorHash}).`,
);
}
})(),
Expand Down
Loading