aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorDenton Liu <liu.denton+github@gmail.com>2016-08-12 23:07:02 +0800
committerDenton Liu <liu.denton+github@gmail.com>2016-08-12 23:08:53 +0800
commit0b3ad9262cd99ae4788e14f399905952c16d5d27 (patch)
tree5c50ac377fc8c8d82aaf4d0018213b36a48c56d9 /docs
parent269a6d1379166bd1e32129db467212bd7663d4af (diff)
downloaddexon-solidity-0b3ad9262cd99ae4788e14f399905952c16d5d27.tar
dexon-solidity-0b3ad9262cd99ae4788e14f399905952c16d5d27.tar.gz
dexon-solidity-0b3ad9262cd99ae4788e14f399905952c16d5d27.tar.bz2
dexon-solidity-0b3ad9262cd99ae4788e14f399905952c16d5d27.tar.lz
dexon-solidity-0b3ad9262cd99ae4788e14f399905952c16d5d27.tar.xz
dexon-solidity-0b3ad9262cd99ae4788e14f399905952c16d5d27.tar.zst
dexon-solidity-0b3ad9262cd99ae4788e14f399905952c16d5d27.zip
Fix code
Diffstat (limited to 'docs')
-rw-r--r--docs/common-patterns.rst12
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/common-patterns.rst b/docs/common-patterns.rst
index 8d0b28af..6302af72 100644
--- a/docs/common-patterns.rst
+++ b/docs/common-patterns.rst
@@ -32,7 +32,7 @@ become the new richest.
address public richest;
uint public mostSent;
- mapping (address => uint) pending;
+ mapping (address => uint) pendingWithdrawals;
function WithdrawalContract() {
richest = msg.sender;
@@ -41,7 +41,7 @@ become the new richest.
function becomeRichest() returns (bool) {
if (msg.value > mostSent) {
- pending[richest] = msg.value;
+ pendingWithdrawals[richest] += msg.value;
richest = msg.sender;
mostSent = msg.value;
return true;
@@ -52,10 +52,10 @@ become the new richest.
}
function withdraw() {
- uint amount = pending[msg.sender];
- // Remember to zero the pending refund before sending
- // to prevent re-entrancy attacks
- pending[msg.sender] = 0;
+ 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;
}