Does Reentrancy occur only in a contract(A) interacting with another contract(B) with any transfer of ether?

From the solidity docs’ security considerations, I was able to know about this pitfall…
I was curious as to how it can happen that any transfer of ether to B hands over the control to B from A?

Does it only happen for ether transfers between contracts and not for individual accounts?

It says that “Ether transfer can always include code execution, so the recipient could be a contract that calls backs into that function”.
What does the code execution part mean?

1 Like

Hi @asmeedhungana,

I suggest reading the “What is Reentrancy” section (and also the whole post) from Reentrancy After Istanbul.

Sending Ether from Contract A to Contract B involves Contract A calling functionality on Contract B which depending on the available gas and mechanism used, could result in Contract B calling back into Contract A.

This is only for a contract calling an address that is also a contract, and not for a contract calling externally owned accounts.

1 Like

Thanks a lot, as always! I’ll make sure to look into that link and come back in case of any confusion(which is sure to happen) :grin:

1 Like