Replies: 2 comments 9 replies
-
First of all, to clear your confusion of So, require(!lock, "Reentrancy call..reverting"); since the Consequently, the |
Beta Was this translation helpful? Give feedback.
1 reply
-
@ManuWeb3 Wrap the address in a payable because you are going to send money to it. (bool sent, ) = payable(msg.sender).call{value: bal}(""); |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
I'm wondering why "Failed to send Ether" error string shows up when the transaction reverts instead of "Reentrancy call..reverting" error string ?
When
ReentrancyGuard
is in place in thewithdraw( )
and.attack( )
is invoked, it reverts in the second loop of its nested callback becauselock
got set totrue
in the first iteration, which meansrequire(!lock, "Reentrancy call..reverting");
reverted the nested callback by.attack()
.So, why we see error string of
require(sent, "Failed to send Ether");
?Is it because when
withdraw()
reverted (due tolock
set totrue
),.call()
failed andsent
got set tofalse
?OR
something else fired the string "Failed to send Ether" instead of "Reentrancy call..reverting" ?
=====================
Beta Was this translation helpful? Give feedback.
All reactions