Skip to content

Commit

Permalink
Improve error when genesis block returned is null (#282)
Browse files Browse the repository at this point in the history
* Improve error when genesis block returned is null

* Update changelog
  • Loading branch information
stwiname authored Apr 29, 2024
1 parent 7b2ac9f commit 0014d1d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Dictionary v2 transactions query not including address (#281)

### Changed
- Improved error message if genesis block is null (#282)

## [4.1.1] - 2024-04-16
### Fixed
- Dictionary v2 query filter with transactions (#278)
Expand Down
8 changes: 6 additions & 2 deletions packages/node/src/ethereum/api.ethereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export class EthereumApi implements ApiWrapper {
try {
// We set the timeout here because there is a bug in ethers where it will never resolve
// It was happening with arbitrum on a syncing node
const result = await timeout(this.client.getBlock(tag), 2);
await timeout(this.client.getBlock(tag), 2);

return true;
} catch (e) {
Expand Down Expand Up @@ -224,7 +224,11 @@ export class EthereumApi implements ApiWrapper {
}
};

return this.client.getBlock(tag());
const block = await this.client.getBlock(tag());
if (block === null) {
throw new Error(`Getting genesis block returned null from tag: ${tag()}`);
}
return block;
}

async getFinalizedBlock(): Promise<Block> {
Expand Down

0 comments on commit 0014d1d

Please sign in to comment.