use of io.nuls.consensus.poc.tx.validator.CreateAgentTxValidator in project nuls by nuls-io.
the class CreateAgentTxValidatorTest method test.
@Test
public void test() {
CreateAgentTransaction tx = new CreateAgentTransaction();
CreateAgentTxValidator validator = new CreateAgentTxValidator();
ValidateResult result = validator.validate(tx);
assertFalse(result.isSuccess());
Agent agent = new Agent();
tx.setTxData(agent);
result = validator.validate(tx);
assertFalse(result.isSuccess());
byte[] address = AddressTool.getAddress(ecKey.getPubKey());
byte[] address1 = AddressTool.getAddress(new ECKey().getPubKey());
byte[] address2 = AddressTool.getAddress(new ECKey().getPubKey());
agent.setRewardAddress(address);
agent.setPackingAddress(address1);
agent.setAgentAddress(address2);
result = validator.validate(tx);
assertFalse(result.isSuccess());
agent.setDeposit(PocConsensusProtocolConstant.AGENT_DEPOSIT_LOWER_LIMIT);
tx.setTime(System.currentTimeMillis());
result = validator.validate(tx);
assertTrue(result.isSuccess());
}
Aggregations