use of com.hederahashgraph.api.proto.java.SignatureMap in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerScheduleTest method scheduleSign.
@Test
void scheduleSign() {
insertScheduleCreateTransaction(CREATE_TIMESTAMP, null, SCHEDULE_ID);
// sign
SignatureMap signatureMap = getSigMap(3, true);
insertScheduleSign(SIGN_TIMESTAMP, signatureMap, SCHEDULE_ID);
// verify entity count
assertEquals(1, entityRepository.count());
// verify schedule
assertThat(scheduleRepository.count()).isOne();
assertScheduleInRepository(SCHEDULE_ID, CREATE_TIMESTAMP, PAYER, null);
// verify schedule signatures
List<TransactionSignature> expectedTransactionSignatureList = new ArrayList<>(defaultSignatureList);
expectedTransactionSignatureList.addAll(toTransactionSignatureList(SIGN_TIMESTAMP, SCHEDULE_ID, signatureMap));
assertTransactionSignatureInRepository(expectedTransactionSignatureList);
// verify transaction
assertTransactionInRepository(SIGN_TIMESTAMP, false, SUCCESS);
}
use of com.hederahashgraph.api.proto.java.SignatureMap in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerScheduleTest method getSigMap.
private SignatureMap getSigMap(int signatureCount, boolean isEd25519) {
SignatureMap.Builder builder = SignatureMap.newBuilder();
String salt = RandomStringUtils.randomAlphabetic(5);
for (int i = 0; i < signatureCount; i++) {
SignaturePair.Builder signaturePairBuilder = SignaturePair.newBuilder();
signaturePairBuilder.setPubKeyPrefix(ByteString.copyFromUtf8("PubKeyPrefix-" + i + salt));
ByteString byteString = ByteString.copyFromUtf8("Ed25519-" + i + salt);
if (isEd25519) {
signaturePairBuilder.setEd25519(byteString);
} else {
signaturePairBuilder.setRSA3072(byteString);
}
builder.addSigPair(signaturePairBuilder.build());
}
return builder.build();
}
Aggregations