From ad5d28bc485e773b61538e59fc197b084e34d9b4 Mon Sep 17 00:00:00 2001 From: Ed Hennis Date: Fri, 11 Jul 2025 16:14:10 -0400 Subject: [PATCH] Make a few tweaks to the changes in merge cc83ea8 - Not necessarily wrong, just not how I want it. - Fixes a build error in LoanBroker_test - In CreateOffer, fixes a logic error where _no_ offers will work if PermissionedDex amendment is enabled, and FlowCross is not --- src/libxrpl/protocol/STTx.cpp | 17 ++++++++++------- src/test/app/LoanBroker_test.cpp | 2 ++ src/test/jtx/TestHelpers.h | 2 +- src/xrpld/app/tx/detail/CreateOffer.cpp | 7 ++----- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/libxrpl/protocol/STTx.cpp b/src/libxrpl/protocol/STTx.cpp index 162a9a756c..a1d30c63e5 100644 --- a/src/libxrpl/protocol/STTx.cpp +++ b/src/libxrpl/protocol/STTx.cpp @@ -495,6 +495,8 @@ multiSignHelper( auto const accountID = signer.getAccountID(sfAccount); // The account owner may not usually multisign for themselves. + // If they can, txnAccountID will be unseated, which is not equal to any + // value. if (txnAccountID == accountID) return Unexpected("Invalid multisigner."); @@ -556,7 +558,7 @@ STTx::checkBatchMultiSign( batchSigner, std::nullopt, fullyCanonical, - [&dataStart](AccountID const& accountID) mutable -> Serializer { + [&dataStart](AccountID const& accountID) -> Serializer { Serializer s = dataStart; finishMultiSigningData(accountID, s); return s; @@ -588,7 +590,7 @@ STTx::checkMultiSign( sigObject, txnAccountID, fullyCanonical, - [&dataStart](AccountID const& accountID) mutable -> Serializer { + [&dataStart](AccountID const& accountID) -> Serializer { Serializer s = dataStart; finishMultiSigningData(accountID, s); return s; @@ -620,11 +622,12 @@ STTx::getBatchTransactionIDs() const XRPL_ASSERT( getFieldArray(sfRawTransactions).size() != 0, "STTx::getBatchTransactionIDs : empty raw transactions"); - if (batch_txn_ids_.size() != 0) - return batch_txn_ids_; - - for (STObject const& rb : getFieldArray(sfRawTransactions)) - batch_txn_ids_.push_back(rb.getHash(HashPrefix::transactionID)); + // Don't early return so that the size check is always done. + if (batch_txn_ids_.size() == 0) + { + for (STObject const& rb : getFieldArray(sfRawTransactions)) + batch_txn_ids_.push_back(rb.getHash(HashPrefix::transactionID)); + } XRPL_ASSERT( batch_txn_ids_.size() == getFieldArray(sfRawTransactions).size(), diff --git a/src/test/app/LoanBroker_test.cpp b/src/test/app/LoanBroker_test.cpp index 941d33103e..d52fc759a9 100644 --- a/src/test/app/LoanBroker_test.cpp +++ b/src/test/app/LoanBroker_test.cpp @@ -197,6 +197,8 @@ class LoanBroker_test : public beast::unit_test::suite auto verifyCoverAmount = [&env, &vault, &broker, &pseudoAccount, this](auto n) { + using namespace jtx; + auto const amount = vault.asset(n); BEAST_EXPECT( broker->at(sfCoverAvailable) == amount.number()); diff --git a/src/test/jtx/TestHelpers.h b/src/test/jtx/TestHelpers.h index f7f7a601fc..85a46ad76a 100644 --- a/src/test/jtx/TestHelpers.h +++ b/src/test/jtx/TestHelpers.h @@ -615,7 +615,7 @@ create( } // namespace check -static constexpr FeeLevel64 baseFeeLevel{256}; +static constexpr FeeLevel64 baseFeeLevel{TxQ::baseLevel}; static constexpr FeeLevel64 minEscalationFeeLevel = baseFeeLevel * 500; template diff --git a/src/xrpld/app/tx/detail/CreateOffer.cpp b/src/xrpld/app/tx/detail/CreateOffer.cpp index 815bad994d..3734f0787e 100644 --- a/src/xrpld/app/tx/detail/CreateOffer.cpp +++ b/src/xrpld/app/tx/detail/CreateOffer.cpp @@ -48,12 +48,9 @@ CreateOffer::isEnabled(PreflightContext const& ctx) { // Permissioned offers should use the PE (which must be enabled by // featureFlowCross amendment) - if (ctx.rules.enabled(featurePermissionedDEX) && - !ctx.rules.enabled(featureFlowCross)) - return false; - return (!ctx.tx.isFieldPresent(sfDomainID)) || - ctx.rules.enabled(featurePermissionedDEX); + (ctx.rules.enabled(featurePermissionedDEX) && + ctx.rules.enabled(featureFlowCross)); } std::uint32_t