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:
@@ -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];
|
||||
}
|
||||
|
Reference in New Issue
Block a user