From afff39656826e59283dbb3b5fc092c54aaf2afbd Mon Sep 17 00:00:00 2001 From: Manimaran Date: Mon, 29 Jun 2026 19:34:54 +0530 Subject: [PATCH] fix: Add defensive error check to mpt_get_send_context_hash - Add error checking to getSendContextHash() function - Return error if mpt_get_send_context_hash() fails - Add period to tecBAD_PROOF error message for consistency Fixes #7651 Signed-off-by: Manimaran --- src/libxrpl/protocol/ConfidentialTransfer.cpp | 17 ++++++++++------- src/libxrpl/protocol/TER.cpp | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/libxrpl/protocol/ConfidentialTransfer.cpp b/src/libxrpl/protocol/ConfidentialTransfer.cpp index 0baff1e33ac..bf629af54a4 100644 --- a/src/libxrpl/protocol/ConfidentialTransfer.cpp +++ b/src/libxrpl/protocol/ConfidentialTransfer.cpp @@ -70,13 +70,16 @@ getSendContextHash( std::uint32_t version) { uint256 result; - mpt_get_send_context_hash( - toAccountId(account), - toIssuanceId(issuanceID), - sequence, - toAccountId(destination), - version, - result.data()); + if (mpt_get_send_context_hash( + toAccountId(account), + toIssuanceId(issuanceID), + sequence, + toAccountId(destination), + version, + result.data()) != 0) + { + Throw("Failed to compute send context hash"); + } return result; } diff --git a/src/libxrpl/protocol/TER.cpp b/src/libxrpl/protocol/TER.cpp index e5c1d17b1a9..9f05253dcc4 100644 --- a/src/libxrpl/protocol/TER.cpp +++ b/src/libxrpl/protocol/TER.cpp @@ -106,7 +106,7 @@ transResults() MAKE_ERROR(tecLIMIT_EXCEEDED, "Limit exceeded."), MAKE_ERROR(tecPSEUDO_ACCOUNT, "This operation is not allowed against a pseudo-account."), MAKE_ERROR(tecPRECISION_LOSS, "The amounts used by the transaction cannot interact."), - MAKE_ERROR(tecBAD_PROOF, "Proof cannot be verified"), + MAKE_ERROR(tecBAD_PROOF, "Proof cannot be verified."), MAKE_ERROR(tefALREADY, "The exact transaction was already in this ledger."), MAKE_ERROR(tefBAD_ADD_AUTH, "Not authorized to add account."),