Commit e9cf6dfb by Francisco Giordano Committed by GitHub

Merge pull request #323 from pooleja/fix/ownable_error

Fix/ownable error - Silent transferOwnership Failure
parents 4d91118d 64787b1a
......@@ -33,9 +33,8 @@ contract Ownable {
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) {
require(newOwner != address(0));
owner = newOwner;
}
}
}
......@@ -36,10 +36,12 @@ contract('Ownable', function(accounts) {
it('should guard ownership against stuck state', async function() {
let originalOwner = await ownable.owner();
try {
await ownable.transferOwnership(null, {from: originalOwner});
let newOwner = await ownable.owner();
assert.equal(originalOwner, newOwner);
assert.fail();
} catch(error) {
assertJump(error);
}
});
});
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment