use of com.hedera.mirror.common.domain.addressbook.AddressBookEntry in project hedera-mirror-node by hashgraph.
the class AddressBookServiceEndpointRepositoryTest method addressBookEntry.
private AddressBookEntry addressBookEntry(long consensusTimestamp, long nodeAccountId, List<Integer> portNums) throws UnknownHostException {
long nodeId = nodeAccountId - 3;
String nodeAccountIdString = String.format("0.0.%s", nodeAccountId);
EntityId nodeAccountEntityId = EntityId.of(nodeAccountIdString, EntityType.ACCOUNT);
AddressBookEntry.AddressBookEntryBuilder builder = AddressBookEntry.builder().consensusTimestamp(consensusTimestamp).memo(nodeAccountIdString).nodeAccountId(nodeAccountEntityId).nodeCertHash("nodeCertHash".getBytes()).nodeId(nodeId).publicKey("rsa+public/key");
if (!CollectionUtils.isEmpty(portNums)) {
Set<AddressBookServiceEndpoint> serviceEndpoints = new HashSet<>();
for (int i = 0; i < portNums.size(); i++) {
serviceEndpoints.add(addressBookServiceEndpoint(consensusTimestamp, InetAddress.getByName("127.0.0." + i).getHostAddress(), portNums.get(i), nodeId));
}
builder.serviceEndpoints(serviceEndpoints);
}
return builder.build();
}
Aggregations