mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-07 07:16:42 +02:00
Fixed withdrawal check
This commit is contained in:
@@ -49,7 +49,10 @@ contract AcmeBank {
|
|||||||
function withdraw(uint withdrawAmount) returns (uint remainingBalance) {
|
function withdraw(uint withdrawAmount) returns (uint remainingBalance) {
|
||||||
if(balances[msg.sender] >= withdrawAmount) {
|
if(balances[msg.sender] >= withdrawAmount) {
|
||||||
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];
|
return balances[msg.sender];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user