From bc239bad706acf5c6fa18e8ff2fece58755a9e93 Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt <3esmit@gmail.com> Date: Sun, 30 Sep 2018 00:44:23 -0300 Subject: [PATCH] prevent reentracy from registerUser to slashUsername --- contracts/registry/UsernameRegistrar.sol | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contracts/registry/UsernameRegistrar.sol b/contracts/registry/UsernameRegistrar.sol index 77c814b..6fd448f 100644 --- a/contracts/registry/UsernameRegistrar.sol +++ b/contracts/registry/UsernameRegistrar.sol @@ -605,7 +605,7 @@ contract UsernameRegistrar is Controlled, ApproveAndCallFallBack { emit UsernameOwner(namehash, _owner); } - /** + /** * @dev Removes account hash of `_username` and send account.balance to msg.sender. * @param _username Username being slashed. */ @@ -620,6 +620,7 @@ contract UsernameRegistrar is Controlled, ApproveAndCallFallBack { "Nothing to slash." ); } else { + assert(accounts[label].creationTime != block.timestamp); amountToTransfer = accounts[label].balance; delete accounts[label]; }