Remove _isConstructor() check in initializer modifier (#2531)

* Remove _isConstructor() check in initializer modifier

* add changelog entry
This commit is contained in:
Francisco Giordano
2021-02-18 20:53:00 -03:00
committed by GitHub
parent e733b24dfe
commit 0059b17dfc
2 changed files with 2 additions and 6 deletions

View File

@ -33,7 +33,7 @@ abstract contract Initializable {
* @dev Modifier to protect an initializer function from being invoked twice.
*/
modifier initializer() {
require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized");
require(_initializing || !_initialized, "Initializable: contract is already initialized");
bool isTopLevelCall = !_initializing;
if (isTopLevelCall) {
@ -47,9 +47,4 @@ abstract contract Initializable {
_initializing = false;
}
}
/// @dev Returns true if and only if the function is running in the constructor
function _isConstructor() private view returns (bool) {
return !Address.isContract(address(this));
}
}