Skip to content

Commit

Permalink
Moved sys.exit out of the JSONRPCClient constructor
Browse files Browse the repository at this point in the history
[ci integration]
  • Loading branch information
hackaugusto committed Aug 5, 2018
1 parent 59736c6 commit 68dda4d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
7 changes: 1 addition & 6 deletions 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
Expand Down Expand Up @@ -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')
Expand Down
13 changes: 12 additions & 1 deletion raiden/ui/cli.py
Expand Up @@ -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
Expand Down Expand Up @@ -64,6 +64,7 @@
from raiden.tasks import check_version
from raiden.utils import (
get_system_spec,
is_supported_client,
merge_dict,
split_endpoint,
typing,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 68dda4d

Please sign in to comment.