mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-04-27 07:33:57 +00:00
Fixed withdrawal check
This commit is contained in:
parent
92a736f5e0
commit
d5bcbceb21
@ -49,7 +49,10 @@ contract AcmeBank {
|
||||
function withdraw(uint withdrawAmount) returns (uint remainingBalance) {
|
||||
if(balances[msg.sender] >= withdrawAmount) {
|
||||
balances[msg.sender] -= withdrawAmount;
|
||||
balances[msg.sender].send(withdrawAmount);
|
||||
|
||||
if (!balances[msg.sender].send(withdrawAmount)) {
|
||||
balances[msg.sender] += withdrawAmount;
|
||||
}
|
||||
|
||||
return balances[msg.sender];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user