Change ConfidentialSend preflight error code (#5994)

This commit is contained in:
Shawn Xie
2025-11-03 18:46:27 -05:00
committed by GitHub
parent ec57fbdc5f
commit cd75e630a2
2 changed files with 4 additions and 4 deletions

View File

@@ -910,7 +910,7 @@ class ConfidentialTransfer_test : public beast::unit_test::suite
Buffer(ripple::ecGamalEncryptedTotalLength),
.issuerEncryptedAmt =
Buffer(ripple::ecGamalEncryptedTotalLength),
.err = temMALFORMED});
.err = temBAD_CIPHERTEXT});
// dest encrypted amount wrong length
mptAlice.send(
{.account = bob,
@@ -922,7 +922,7 @@ class ConfidentialTransfer_test : public beast::unit_test::suite
.destEncryptedAmt = Buffer(10), // Incorrect length
.issuerEncryptedAmt =
Buffer(ripple::ecGamalEncryptedTotalLength),
.err = temMALFORMED});
.err = temBAD_CIPHERTEXT});
// issuer encrypted amount wrong length
mptAlice.send(
{.account = bob,
@@ -934,7 +934,7 @@ class ConfidentialTransfer_test : public beast::unit_test::suite
.destEncryptedAmt =
Buffer(ripple::ecGamalEncryptedTotalLength),
.issuerEncryptedAmt = Buffer(10),
.err = temMALFORMED});
.err = temBAD_CIPHERTEXT});
auto const ciphertextHex = generatePlaceholderCiphertext();

View File

@@ -53,7 +53,7 @@ ConfidentialSend::preflight(PreflightContext const& ctx)
ctx.tx[sfDestinationEncryptedAmount].length() !=
ecGamalEncryptedTotalLength ||
ctx.tx[sfIssuerEncryptedAmount].length() != ecGamalEncryptedTotalLength)
return temMALFORMED;
return temBAD_CIPHERTEXT;
if (!isValidCiphertext(ctx.tx[sfSenderEncryptedAmount]) ||
!isValidCiphertext(ctx.tx[sfDestinationEncryptedAmount]) ||