You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuweni.apache.org by to...@apache.org on 2023/01/12 09:30:34 UTC

[incubator-tuweni] branch main updated: throw an explicit exception in case of misconfiguration of the genesis file associated with the rlpx service

This is an automated email from the ASF dual-hosted git repository.

toulmean pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-tuweni.git


The following commit(s) were added to refs/heads/main by this push:
     new bcd9e97eb throw an explicit exception in case of misconfiguration of the genesis file associated with the rlpx service
     new 7aa20a722 Merge pull request #485 from atoulme/validate_genesis_file_present
bcd9e97eb is described below

commit bcd9e97eb205bb414a309981be97606e2f8c3416
Author: Antoine Toulme <an...@lunar-ocean.com>
AuthorDate: Tue Jan 10 23:57:34 2023 -0800

    throw an explicit exception in case of misconfiguration of the genesis file associated with the rlpx service
---
 .../src/main/kotlin/org/apache/tuweni/ethclient/EthereumClient.kt    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/eth-client/src/main/kotlin/org/apache/tuweni/ethclient/EthereumClient.kt b/eth-client/src/main/kotlin/org/apache/tuweni/ethclient/EthereumClient.kt
index a4d5dd945..d6e7fac60 100644
--- a/eth-client/src/main/kotlin/org/apache/tuweni/ethclient/EthereumClient.kt
+++ b/eth-client/src/main/kotlin/org/apache/tuweni/ethclient/EthereumClient.kt
@@ -241,10 +241,13 @@ class EthereumClient(
           )
         }
         val genesisFile = repoToGenesisFile[repository]
+          ?: throw IllegalArgumentException(
+            "Genesis file associated with repository ${rlpxConfig.repository()} not found"
+          )
         val genesisBlock = repository.retrieveGenesisBlock()
         val adapter = WireConnectionPeerRepositoryAdapter(peerRepository)
         val blockchainInfo = SimpleBlockchainInformation(
-          UInt256.valueOf(genesisFile!!.chainId.toLong()),
+          UInt256.valueOf(genesisFile.chainId.toLong()),
           genesisBlock.header.difficulty,
           genesisBlock.header.hash,
           genesisBlock.header.number,


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tuweni.apache.org
For additional commands, e-mail: commits-help@tuweni.apache.org