medium10 pts · first answer countssecurityreentrancy
Spot the reentrancy bug
What is the main problem in this withdraw function?
function withdraw() external {
uint256 amount = balances[msg.sender];
(bool ok, ) = msg.sender.call{value: amount}("");
require(ok, "fail");
balances[msg.sender] = 0;
}Discussion 0
Join free to post in the discussion.
Related questions
- The checks-effects-interactions orderBlockchain Developer
- What nonReentrant doesBlockchain Developer
- Using tx.origin for authBlockchain Developer
- Upgrading a proxy safelyBlockchain Developer
- Overflow in Solidity 0.8Blockchain Developer
- Blind signing on a hardware walletBlockchain Developer
- Building Sign-In with EthereumBlockchain Developer
- Relying on the contract balanceBlockchain Developer