From 3e3d060d996ecfe9b667aa02f6a2b13411d8a7d0 Mon Sep 17 00:00:00 2001 From: "Augusto F. Hack" Date: Sun, 5 Aug 2018 17:56:18 -0300 Subject: [PATCH] Moved sys.exit out of the JSONRPCClient constructor [ci integration] --- raiden/network/rpc/client.py | 7 +------ raiden/ui/cli.py | 13 ++++++++++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/raiden/network/rpc/client.py b/raiden/network/rpc/client.py index 101f09ed7d..6ea8d3c67a 100644 --- a/raiden/network/rpc/client.py +++ b/raiden/network/rpc/client.py @@ -1,6 +1,5 @@ import copy import os -import sys import warnings from binascii import unhexlify from json.decoder import JSONDecodeError @@ -203,11 +202,7 @@ def __init__( except ConnectTimeout: raise EthNodeCommunicationError('couldnt reach the ethereum node') - supported, eth_node = is_supported_client(version) - - if not supported: - print('You need a Byzantium enabled ethereum node. Parity >= 1.7.6 or Geth >= 1.7.2') - sys.exit(1) + _, eth_node = is_supported_client(version) sender = privatekey_to_address(privkey) transaction_count = web3.eth.getTransactionCount(to_checksum_address(sender), 'pending') diff --git a/raiden/ui/cli.py b/raiden/ui/cli.py index 68f95251fd..d935080aef 100644 --- a/raiden/ui/cli.py +++ b/raiden/ui/cli.py @@ -30,7 +30,7 @@ to_normalized_address, ) from mirakuru import ProcessExitedWithError -from requests.exceptions import RequestException +from requests.exceptions import ConnectTimeout, RequestException from web3 import Web3, HTTPProvider from raiden import constants @@ -64,6 +64,7 @@ from raiden.tasks import check_version, check_gas_reserve from raiden.utils import ( get_system_spec, + is_supported_client, merge_dict, split_endpoint, typing, @@ -599,6 +600,16 @@ def run_app( web3 = Web3(HTTPProvider(eth_rpc_endpoint)) + try: + node_version = web3.version.node # pylint: disable=no-member + except ConnectTimeout: + raise EthNodeCommunicationError('couldnt reach the ethereum node') + + supported, _ = is_supported_client(node_version) + if not supported: + print('You need a Byzantium enabled ethereum node. Parity >= 1.7.6 or Geth >= 1.7.2') + sys.exit(1) + rpc_client = JSONRPCClient( web3, privatekey_bin,