mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Reformat code
This commit is contained in:
parent
70e5af11ef
commit
811980afe6
@ -50,13 +50,13 @@ complete contract):
|
|||||||
|
|
||||||
// THIS CONTRACT CONTAINS A BUG - DO NOT USE
|
// THIS CONTRACT CONTAINS A BUG - DO NOT USE
|
||||||
contract Fund {
|
contract Fund {
|
||||||
/// Mapping of ether shares of the contract.
|
/// Mapping of ether shares of the contract.
|
||||||
mapping(address => uint) shares;
|
mapping(address => uint) shares;
|
||||||
/// Withdraw your share.
|
/// Withdraw your share.
|
||||||
function withdraw() {
|
function withdraw() {
|
||||||
if (msg.sender.send(shares[msg.sender]))
|
if (msg.sender.send(shares[msg.sender]))
|
||||||
shares[msg.sender] = 0;
|
shares[msg.sender] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
The problem is not too serious here because of the limited gas as part
|
The problem is not too serious here because of the limited gas as part
|
||||||
@ -71,18 +71,17 @@ outlined further below:
|
|||||||
::
|
::
|
||||||
|
|
||||||
contract Fund {
|
contract Fund {
|
||||||
/// Mapping of ether shares of the contract.
|
/// Mapping of ether shares of the contract.
|
||||||
mapping(address => uint) shares;
|
mapping(address => uint) shares;
|
||||||
/// Withdraw your share.
|
/// Withdraw your share.
|
||||||
function withdraw() {
|
function withdraw() {
|
||||||
var share = shares[msg.sender];
|
var share = shares[msg.sender];
|
||||||
shares[msg.sender] = 0;
|
shares[msg.sender] = 0;
|
||||||
if (!msg.sender.send(share))
|
if (!msg.sender.send(share))
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Note that re-entrancy is not only an effect of Ether transfer but of any
|
Note that re-entrancy is not only an effect of Ether transfer but of any
|
||||||
function call on another contract. Furthermore, you also have to take
|
function call on another contract. Furthermore, you also have to take
|
||||||
multi-contract situations into account. A called contract could modify the
|
multi-contract situations into account. A called contract could modify the
|
||||||
|
Loading…
Reference in New Issue
Block a user