Remove _isConstructor() check in initializer modifier (#2531)
* Remove _isConstructor() check in initializer modifier * add changelog entry
This commit is contained in:
committed by
GitHub
parent
e733b24dfe
commit
0059b17dfc
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user