prevent reentracy from registerUser to slashUsername

This commit is contained in:
Ricardo Guilherme Schmidt 2018-09-30 00:44:23 -03:00
parent c81f6d405e
commit bc239bad70
No known key found for this signature in database
GPG Key ID: 3F95A3AD0B607030

View File

@ -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];
}