From 57168ad33e44e1e53c8d09656febb4629d42e6cf Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Sat, 4 Nov 2017 14:33:47 -0500 Subject: [PATCH] chequebook: use require keyword --- contracts/chequebook/contract/chequebook.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/chequebook/contract/chequebook.sol b/contracts/chequebook/contract/chequebook.sol index cc1a24888b..131b856dec 100644 --- a/contracts/chequebook/contract/chequebook.sol +++ b/contracts/chequebook/contract/chequebook.sol @@ -23,10 +23,10 @@ contract chequebook is mortal { uint8 sig_v, bytes32 sig_r, bytes32 sig_s) { // Check if the cheque is old. // Only cheques that are more recent than the last cashed one are considered. - if(amount <= sent[beneficiary]) return; + require(amount > sent[beneficiary]); // Check the digital signature of the cheque. bytes32 hash = keccak256(address(this), beneficiary, amount); - if(owner != ecrecover(hash, sig_v, sig_r, sig_s)) return; + require(owner == ecrecover(hash, sig_v, sig_r, sig_s)); // Attempt sending the difference between the cumulative amount on the cheque // and the cumulative amount on the last cashed cheque to beneficiary. uint256 diff = amount - sent[beneficiary];