Skip to content

Commit

Permalink
Adapt settle method in MockClient for contracts update (raiden-networ…
Browse files Browse the repository at this point in the history
  • Loading branch information
palango committed Jun 18, 2018
1 parent 4f6db21 commit 75af352
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions raiden_libs/test/mocks/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,16 +215,32 @@ def settle_channel(
assert len(transferred) == 2
assert len(locked) == 2
assert len(locksroot) == 2
self.contract.functions.settleChannel(
self.address,
transferred[0],
locked[0],
locksroot[0],
partner_address,
transferred[1],
locked[1],
locksroot[1]
).transact({'from': self.address})

# locked + transferred amount of p2 have to be bigger than p1 for the settle call
# fix order if necessary
if transferred[0] + locked[0] > transferred[1] + locked[1]:
print('reorder')
self.contract.functions.settleChannel(
partner_address,
transferred[1],
locked[1],
locksroot[1],
self.address,
transferred[0],
locked[0],
locksroot[0],
).transact({'from': self.address})
else:
self.contract.functions.settleChannel(
self.address,
transferred[0],
locked[0],
locksroot[0],
partner_address,
transferred[1],
locked[1],
locksroot[1],
).transact({'from': self.address})

@assert_channel_existence
def get_balance_proof(self, partner_address: Address, **kwargs) -> BalanceProof:
Expand Down

0 comments on commit 75af352

Please sign in to comment.