From 48379354bc3303ddf0d8f50538555eefeb0c4871 Mon Sep 17 00:00:00 2001 From: vzotova Date: Fri, 27 Mar 2020 12:01:40 +0300 Subject: [PATCH] Apply suggestions from code review #1788 Co-Authored-By: Derek Pierre --- nucypher/blockchain/eth/actors.py | 2 +- .../main/staking_contracts/test_preallocation_escrow.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/nucypher/blockchain/eth/actors.py b/nucypher/blockchain/eth/actors.py index 74207c1b8..75dbaf50b 100644 --- a/nucypher/blockchain/eth/actors.py +++ b/nucypher/blockchain/eth/actors.py @@ -1127,7 +1127,7 @@ class Staker(NucypherTokenActor): """Collect rewarded ETH.""" if self.is_contract: if collector_address and collector_address != self.beneficiary_address: - raise ValueError("Allowed to withdraw policy reward only to the beneficiary address") + raise ValueError("Policy rewards must be withdrawn to the beneficiary address") self.preallocation_escrow_agent.collect_policy_reward() # TODO save receipt receipt = self.preallocation_escrow_agent.withdraw_eth() else: diff --git a/tests/blockchain/eth/contracts/main/staking_contracts/test_preallocation_escrow.py b/tests/blockchain/eth/contracts/main/staking_contracts/test_preallocation_escrow.py index 48d1d8477..723017d9a 100644 --- a/tests/blockchain/eth/contracts/main/staking_contracts/test_preallocation_escrow.py +++ b/tests/blockchain/eth/contracts/main/staking_contracts/test_preallocation_escrow.py @@ -184,8 +184,11 @@ def test_withdraw_eth(testerchain, preallocation_escrow): {'from': testerchain.client.coinbase, 'to': preallocation_escrow.address, 'value': value}) testerchain.wait_for_receipt(tx) - tx = preallocation_escrow.functions.withdrawETH().transact({'from': owner}) + balance = testerchain.client.get_balance(owner) + tx = preallocation_escrow.functions.withdrawETH().transact({'from': owner, 'gas_price': 0}) testerchain.wait_for_receipt(tx) + assert testerchain.client.get_balance(preallocation_escrow.address) == 0 + assert testerchain.client.get_balance(owner) == balance + value events = log.get_all_entries() assert len(events) == 1