Commit 5f6b7f93 by Steve Ellis

add check prevening ownables from getting stuck

parent a3362f72
......@@ -17,7 +17,7 @@ contract Ownable {
}
function transfer(address newOwner) onlyOwner {
owner = newOwner;
if (newOwner != address(0)) owner = newOwner;
}
}
......@@ -34,4 +34,20 @@ contract('Ownable', function(accounts) {
.then(done)
});
it("should guard ownership against stuck state" ,function(done) {
var ownable = Ownable.deployed();
return ownable.owner()
.then(function (originalOwner) {
return ownable.transfer(null, {from: originalOwner})
.then(function() {
return ownable.owner();
})
.then(function(newOwner) {
assert.equal(originalOwner, newOwner);
})
.then(done);
});
});
});
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