Skip to content

Commit

Permalink
pr review
Browse files Browse the repository at this point in the history
  • Loading branch information
hackaugusto authored and LefterisJP committed Sep 15, 2017
1 parent 9ded682 commit 0bcc28d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions raiden/api/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def connect_token_network(
try:
connection_manager = self.raiden.connection_manager_for_token(token_address)
except InvalidAddress:
# token is not yet registered
self.raiden.chain.default_registry.add_token(token_address)

# wait for registration
Expand Down Expand Up @@ -214,7 +215,7 @@ def deposit(self, token_address, partner_address, amount):
given `token_address` in order to be able to do transfers.
Raises:
InvalidAddress: If either token_address or partner_address is not a
InvalidAddress: If either token_address or partner_address is not
20 bytes long.
TransactionThrew: May happen for multiple reasons:
- If the token approval fails, e.g. the token may validate if
Expand Down Expand Up @@ -252,7 +253,7 @@ def deposit(self, token_address, partner_address, amount):
# user spent his balance before deposit.
balance = token.balance_of(self.raiden.address.encode('hex'))
if not balance >= amount:
msg = "Not enough balance to deposit. {} Available={} Tried={}".format(
msg = 'Not enough balance to deposit. {} Available={} Tried={}'.format(
pex(token_address),
balance,
amount,
Expand Down
2 changes: 1 addition & 1 deletion raiden/channel/netting_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ def state_transition(self, state_change):
)
else:
log.warn(
'channel closed on a different block or close event happend twice',
'channel closed on a different block or close event happened twice',
channel_address=pex(self.channel_address),
closed_block=self.external_state.closed_block,
this_block=state_change.block_number
Expand Down
8 changes: 5 additions & 3 deletions raiden/connection_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
CHANNEL_STATE_SETTLED,
)
from raiden.exceptions import (
TransactionThrew,
AddressWithoutCode,
TransactionThrew,
)

log = slogging.get_logger(__name__) # pylint: disable=invalid-name
Expand Down Expand Up @@ -265,8 +265,10 @@ def _open_and_deposit(self, partner, funding_amount):
partner,
funding_amount,
)
except (TransactionThrew, AddressWithoutCode):
pass
except AddressWithoutCode:
log.warn('connection manager: channel closed just after it was created')
except TransactionThrew:
log.exception('connection manager: deposit failed')

def find_new_partners(self, number):
"""Search the token network for potential channel partners.
Expand Down

0 comments on commit 0bcc28d

Please sign in to comment.