aboutsummaryrefslogtreecommitdiffstats
path: root/docs/common-patterns.rst
diff options
context:
space:
mode:
Diffstat (limited to 'docs/common-patterns.rst')
-rw-r--r--docs/common-patterns.rst10
1 files changed, 7 insertions, 3 deletions
diff --git a/docs/common-patterns.rst b/docs/common-patterns.rst
index 6302af72..12c6f20c 100644
--- a/docs/common-patterns.rst
+++ b/docs/common-patterns.rst
@@ -51,13 +51,17 @@ become the new richest.
}
}
- function withdraw() {
+ function withdraw() returns (bool) {
uint amount = pendingWithdrawals[msg.sender];
// Remember to zero the pending refund before
// sending to prevent re-entrancy attacks
pendingWithdrawals[msg.sender] = 0;
- if (!msg.sender.send(amount)) {
- throw;
+ if (msg.sender.send(amount)) {
+ return true;
+ }
+ else {
+ pendingWithdrawals[msg.sender] = amount;
+ return false;
}
}
}