use of com.hederahashgraph.api.proto.java.SignaturePair in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerScheduleTest method scheduleSignDuplicateEd25519Signatures.
@Test
void scheduleSignDuplicateEd25519Signatures() {
SignatureMap signatureMap = getSigMap(3, true);
SignaturePair first = signatureMap.getSigPair(0);
SignaturePair third = signatureMap.getSigPair(2);
SignatureMap signatureMapWithDuplicate = signatureMap.toBuilder().addSigPair(first).addSigPair(third).build();
insertScheduleSign(SIGN_TIMESTAMP, signatureMapWithDuplicate, SCHEDULE_ID);
// verify lack of schedule data and transaction
assertTransactionSignatureInRepository(toTransactionSignatureList(SIGN_TIMESTAMP, SCHEDULE_ID, signatureMap));
assertThat(transactionRepository.count()).isEqualTo(1);
}
use of com.hederahashgraph.api.proto.java.SignaturePair in project hedera-services by hashgraph.
the class PojoSigMapPubKeyToSigBytesTest method rejectsNonUniqueSigBytes.
@Test
void rejectsNonUniqueSigBytes() {
// given:
String str = "TEST_STRING";
byte[] pubKey = str.getBytes(StandardCharsets.UTF_8);
SignaturePair sigPair = SignaturePair.newBuilder().setPubKeyPrefix(ByteString.copyFromUtf8(str)).build();
SignatureMap sigMap = SignatureMap.newBuilder().addSigPair(sigPair).addSigPair(sigPair).build();
PojoSigMapPubKeyToSigBytes sigMapPubKeyToSigBytes = new PojoSigMapPubKeyToSigBytes(sigMap);
// expect:
KeyPrefixMismatchException exception = assertThrows(KeyPrefixMismatchException.class, () -> {
sigMapPubKeyToSigBytes.sigBytesFor(pubKey);
});
assertEquals("Source signature map with prefix 544553545f535452494e47 is ambiguous for given public key! " + "(544553545f535452494e47)", exception.getMessage());
}
Aggregations