1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-06 06:47:54 +02:00

Fixed withdrawal check

This commit is contained in:
Nemil Dalal
2015-11-23 16:07:17 -05:00
parent 92a736f5e0
commit d5bcbceb21

View File

@@ -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];
}