mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Remove throw from withdrawal pattern
This commit is contained in:
		
							parent
							
								
									0b3ad9262c
								
							
						
					
					
						commit
						e27493aa83
					
				| @ -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; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user