"fix" replaceKey

This commit is contained in:
Ricardo Guilherme Schmidt 2018-05-09 02:52:05 -03:00
parent 66555cd4b5
commit 3a62fcf5db
1 changed files with 4 additions and 3 deletions

View File

@ -224,11 +224,13 @@ contract Identity is ERC725, ERC735, MessageSigned {
/** /**
* @notice Replaces one `_oldKey` with other `_newKey` * @notice Replaces one `_oldKey` with other `_newKey`
* @param _purpose what purpose being replaced
* @param _oldKey key to remove * @param _oldKey key to remove
* @param _newKey key to add * @param _newKey key to add
* @param _newType inform type of `_newKey` * @param _newType inform type of `_newKey`
*/ */
function replaceKey( function replaceKey(
uint256 _purpose,
bytes32 _oldKey, bytes32 _oldKey,
bytes32 _newKey, bytes32 _newKey,
uint256 _newType uint256 _newType
@ -237,9 +239,8 @@ contract Identity is ERC725, ERC735, MessageSigned {
managementOnly managementOnly
returns (bool success) returns (bool success)
{ {
uint256 purpose = keys[_oldKey].purpose; _addKey(_newKey, _purpose, _newType);
_addKey(_newKey, purpose, _newType); _removeKey(_oldKey, _purpose);
_removeKey(_oldKey, purpose);
return true; return true;
} }