use of com.hedera.services.legacy.exception.KeyPrefixMismatchException 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());
}
use of com.hedera.services.legacy.exception.KeyPrefixMismatchException in project hedera-services by hashgraph.
the class PlatformSigOpsTest method reportsInvalidSigMap.
@Test
void reportsInvalidSigMap() {
final var subject = new PlatformSigsCreationResult();
subject.setTerminatingEx(new KeyPrefixMismatchException("No!"));
final var status = subject.asCode();
assertEquals(KEY_PREFIX_MISMATCH, status);
}
Aggregations