From ee370fefee741e7b5333eba073c1fff8091fdfba Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Sun, 22 Mar 2026 21:47:31 -0700 Subject: [PATCH] fix issues --- include/xrpl/ledger/helpers/WrappedSLEBase.h | 2 +- src/libxrpl/ledger/helpers/AccountRootHelpers.cpp | 5 ++++- src/libxrpl/ledger/helpers/RippleStateHelpers.cpp | 2 +- src/xrpld/rpc/detail/TransactionSign.cpp | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/xrpl/ledger/helpers/WrappedSLEBase.h b/include/xrpl/ledger/helpers/WrappedSLEBase.h index a53001a2e4..e2183eabd7 100644 --- a/include/xrpl/ledger/helpers/WrappedSLEBase.h +++ b/include/xrpl/ledger/helpers/WrappedSLEBase.h @@ -170,7 +170,7 @@ public: void newSLE() { - XRPL_ASSERT(canModify(), "xrpl::WritableSLE::newSLE : can modify"); + XRPL_ASSERT(!canModify(), "xrpl::WritableSLE::newSLE : mutableSle_ is not null"); mutableSle_ = std::make_shared(key_); } diff --git a/src/libxrpl/ledger/helpers/AccountRootHelpers.cpp b/src/libxrpl/ledger/helpers/AccountRootHelpers.cpp index 70c51427d8..961d09e466 100644 --- a/src/libxrpl/ledger/helpers/AccountRootHelpers.cpp +++ b/src/libxrpl/ledger/helpers/AccountRootHelpers.cpp @@ -14,7 +14,7 @@ namespace xrpl { bool AccountRoot::isGlobalFrozen() const { - if (isXRP(id_)) + if (!exists()) return false; return sle_->isFlag(lsfGlobalFreeze); } @@ -64,6 +64,9 @@ confineOwnerCount( XRPAmount AccountRoot::xrpLiquid(std::int32_t ownerCountAdj, beast::Journal j) const { + if (!exists()) + return beast::zero; + // Return balance minus reserve std::uint32_t const ownerCount = confineOwnerCount( readView_.ownerCountHook(id_, sle_->getFieldU32(sfOwnerCount)), ownerCountAdj); diff --git a/src/libxrpl/ledger/helpers/RippleStateHelpers.cpp b/src/libxrpl/ledger/helpers/RippleStateHelpers.cpp index ead3789b2c..e2efcc1ad0 100644 --- a/src/libxrpl/ledger/helpers/RippleStateHelpers.cpp +++ b/src/libxrpl/ledger/helpers/RippleStateHelpers.cpp @@ -563,7 +563,7 @@ canTransfer(ReadView const& view, Issue const& issue, AccountID const& from, Acc if (issuerId == from || issuerId == to) return tesSUCCESS; auto const issuer = AccountRoot(issuerId, view); - if (issuer.exists()) + if (!issuer.exists()) return tefINTERNAL; // LCOV_EXCL_LINE auto const isRippleDisabled = [&](AccountID account) -> bool { diff --git a/src/xrpld/rpc/detail/TransactionSign.cpp b/src/xrpld/rpc/detail/TransactionSign.cpp index 4e3f39f45b..bac09c9be7 100644 --- a/src/xrpld/rpc/detail/TransactionSign.cpp +++ b/src/xrpld/rpc/detail/TransactionSign.cpp @@ -461,7 +461,7 @@ transactionPreProcessImpl( if (verify) acctSrc.emplace(srcAddressID, *app.openLedger().current()); - if (verify && !acctSrc.value() && acctSrc->exists()) + if (verify && acctSrc.has_value() && !acctSrc->exists()) { // If not offline and did not find account, error. JLOG(j.debug()) << "transactionSign: Failed to find source account "