Skip to content

Commit

Permalink
chore: use finality from config
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherbrumm committed Apr 25, 2024
1 parent 963c0d8 commit 9519898
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions integrations/evm/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ export default class EVM implements IRuntime {
throw new Error(`Config does not have finality defined`);
}

if (!config.includedData.blockWithTransactions && !config.includedData.blockReceipts && !config.includedData.transactionReceipts) {
if (!config.includedData?.blockWithTransactions && !config.includedData?.blockReceipts && !config.includedData?.transactionReceipts) {
throw new Error(`Config require included data`);
}

if (!config.includedData.blockReceipts && !config.includedData.transactionReceipts) {
if (!config.includedData?.blockReceipts && !config.includedData?.transactionReceipts) {
throw new Error(`Config can not include block receipts and transaction receipts at the same time`);
}

Expand All @@ -60,7 +60,7 @@ export default class EVM implements IRuntime {
const block = await provider.getBlockWithTransactions(hexKey);

// only validate if current height is already 'finalized'
if (block.number >= currentHeight - 256) {
if (block.number >= currentHeight - this.config.finality) {
throw new Error(
`Finality not reached yet; waiting for next block`
)
Expand Down

0 comments on commit 9519898

Please sign in to comment.