Skip to content

Commit

Permalink
fix: πŸ› compatibility with nodes not supporting eth_protocolVersion
Browse files Browse the repository at this point in the history
This adds support for nodes that can't respond to the
eth_protocolVersion request. Previously ethlogger would fail when
introspecting the node platform. With this change we just logging a
warning and continue to monitor.
  • Loading branch information
ziegfried committed Mar 30, 2021
1 parent aa6c947 commit 256c4d9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/platforms/generic.ts
Expand Up @@ -99,7 +99,10 @@ export async function fetchDefaultNodeInfo(ethClient: EthereumClient): Promise<D
const [networkId, chainIdResult, protocol] = await Promise.all([
ethClient.request(netVersion()),
ethClient.request(chainId()),
ethClient.request(protocolVersion()),
ethClient.request(protocolVersion()).catch(e => {
warn('Ethereum node failed to respond to protocol version request', e);
return -1;
}),
]);
return { networkId, chainId: chainIdResult, protocolVersion: protocol };
}
Expand Down

0 comments on commit 256c4d9

Please sign in to comment.