Skip to content

Commit

Permalink
Add check for null address in addSolver
Browse files Browse the repository at this point in the history
  • Loading branch information
yondonfu committed Jan 15, 2018
1 parent 291a544 commit b09add6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions contracts/verification/LivepeerVerifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ contract LivepeerVerifier is Manager, IVerifier {
}

function addSolver(address _solver) external onlyControllerOwner {
// Must not be null address
require(_solver != address(0));
// Must not already be a solver
require(!isSolver[_solver]);

Expand Down
4 changes: 4 additions & 0 deletions verification_test/LivepeerVerifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ contract("LivepeerVerifier", accounts => {
})

describe("addSolver", () => {
it("should fail for null address", async () => {
await expectThrow(verifier.addSolver("0x0"))
})

it("should fail if solver is already whitelisted", async () => {
await expectThrow(verifier.addSolver(accounts[0]))
})
Expand Down

0 comments on commit b09add6

Please sign in to comment.