Skip to content

Commit

Permalink
Give up fancy formatting of None
Browse files Browse the repository at this point in the history
  • Loading branch information
pirapira committed Jul 2, 2019
1 parent 36c09a8 commit c540df8
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions raiden/network/rpc/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,22 +173,16 @@ def check_address_has_code(
""" Checks that the given address contains code. """
result = client.web3.eth.getCode(to_checksum_address(address), "latest")

def formatted_contract_name():
if contract_name:
return f"[{contract_name}]: "
else:
return ""

if not result:
raise AddressWithoutCode(
"{}Address {} does not contain code".format(
formatted_contract_name(), to_checksum_address(address)
"[{}]Address {} does not contain code".format(
contract_name, to_checksum_address(address)
)
)

if expected_code is not None and result != expected_code:
raise ContractCodeMismatch(
f"{formatted_contract_name()}Address {to_checksum_address(address)} has wrong code."
f"[{contract_name}]Address {to_checksum_address(address)} has wrong code."
)


Expand Down

0 comments on commit c540df8

Please sign in to comment.