diff --git a/include/xrpl/protocol/jss.h b/include/xrpl/protocol/jss.h index 2b2fe604c5..679b75723c 100644 --- a/include/xrpl/protocol/jss.h +++ b/include/xrpl/protocol/jss.h @@ -729,8 +729,6 @@ JSS(write_load); // out: GetCounts #undef JSS -// clang-format on - } // namespace jss } // namespace ripple diff --git a/src/xrpld/app/tx/detail/SetTrust.cpp b/src/xrpld/app/tx/detail/SetTrust.cpp index e37f62a1aa..fd7c2fa0b1 100644 --- a/src/xrpld/app/tx/detail/SetTrust.cpp +++ b/src/xrpld/app/tx/detail/SetTrust.cpp @@ -216,7 +216,7 @@ SetTrust::preclaim(PreclaimContext const& ctx) // SetTrust if the asset is AMM LP token and AMM is not in empty state. if (sleDst->isFieldPresent(sfAMMID)) { - if (ctx.view.read(keylet::line(id, uDstAccountID, currency))) + if (ctx.view.exists(keylet::line(id, uDstAccountID, currency))) { // pass } @@ -236,7 +236,7 @@ SetTrust::preclaim(PreclaimContext const& ctx) } else if (sleDst->isFieldPresent(sfVaultID)) { - if (ctx.view.read(keylet::line(id, uDstAccountID, currency))) + if (ctx.view.exists(keylet::line(id, uDstAccountID, currency))) { // pass } diff --git a/src/xrpld/app/tx/detail/VaultCreate.cpp b/src/xrpld/app/tx/detail/VaultCreate.cpp index 3bfed03fa5..64b8170efc 100644 --- a/src/xrpld/app/tx/detail/VaultCreate.cpp +++ b/src/xrpld/app/tx/detail/VaultCreate.cpp @@ -108,7 +108,7 @@ VaultCreate::preclaim(PreclaimContext const& ctx) auto issuance = ctx.view.read(keylet::mptIssuance(mptID)); if (!issuance) return tecOBJECT_NOT_FOUND; - if ((issuance->getFlags() & lsfMPTCanTransfer) == 0) + if (!issuance->isFlag(lsfMPTCanTransfer)) return tecNO_AUTH; } else if (vaultAsset.holds()) diff --git a/src/xrpld/app/tx/detail/VaultDelete.cpp b/src/xrpld/app/tx/detail/VaultDelete.cpp index bd67f7526a..52d2f8700b 100644 --- a/src/xrpld/app/tx/detail/VaultDelete.cpp +++ b/src/xrpld/app/tx/detail/VaultDelete.cpp @@ -100,10 +100,6 @@ VaultDelete::doApply() auto const mpt = view().peek(keylet::mptIssuance(vault->at(sfShareMPTID))); if (!mpt) return tefINTERNAL; // LCOV_EXCL_LINE - if (pseudoID != mpt->getAccountID(sfIssuer)) - return tefINTERNAL; // LCOV_EXCL_LINE - if (mpt->at(sfOutstandingAmount) != 0) - return tefINTERNAL; // LCOV_EXCL_LINE if (!view().dirRemove( keylet::ownerDir(pseudoID), (*mpt)[sfOwnerNode], mpt->key(), false)) @@ -121,9 +117,6 @@ VaultDelete::doApply() // Remove the vault from its owner's directory. auto const ownerID = vault->at(sfOwner); - if (ownerID != account_) - return tefINTERNAL; // LCOV_EXCL_LINE - if (!view().dirRemove( keylet::ownerDir(ownerID), vault->at(sfOwnerNode), diff --git a/src/xrpld/app/tx/detail/VaultDeposit.cpp b/src/xrpld/app/tx/detail/VaultDeposit.cpp index 828873fbfe..c5859a002c 100644 --- a/src/xrpld/app/tx/detail/VaultDeposit.cpp +++ b/src/xrpld/app/tx/detail/VaultDeposit.cpp @@ -74,6 +74,8 @@ VaultDeposit::preclaim(PreclaimContext const& ctx) auto issuance = ctx.view.read(keylet::mptIssuance(mptID)); if (!issuance) return tecOBJECT_NOT_FOUND; + if (!issuance->isFlag(lsfMPTCanTransfer)) + return tecNO_AUTH; } else if (vaultAsset.holds()) { diff --git a/src/xrpld/app/tx/detail/VaultSet.cpp b/src/xrpld/app/tx/detail/VaultSet.cpp index f945b85c99..154681e908 100644 --- a/src/xrpld/app/tx/detail/VaultSet.cpp +++ b/src/xrpld/app/tx/detail/VaultSet.cpp @@ -147,13 +147,12 @@ VaultSet::doApply() // sfDomainID flag must be set in the MPTokenIssuance object and can // be freely updated. sleIssuance->setFieldH256(sfDomainID, *domainId); - view().update(sleIssuance); } else if (sleIssuance->isFieldPresent(sfDomainID)) { sleIssuance->makeFieldAbsent(sfDomainID); - view().update(sleIssuance); } + view().update(sleIssuance); } view().update(vault); diff --git a/src/xrpld/app/tx/detail/VaultWithdraw.cpp b/src/xrpld/app/tx/detail/VaultWithdraw.cpp index 09f1cd345b..9cf039bf1b 100644 --- a/src/xrpld/app/tx/detail/VaultWithdraw.cpp +++ b/src/xrpld/app/tx/detail/VaultWithdraw.cpp @@ -76,6 +76,8 @@ VaultWithdraw::preclaim(PreclaimContext const& ctx) auto issuance = ctx.view.read(keylet::mptIssuance(mptID)); if (!issuance) return tecOBJECT_NOT_FOUND; + if (!issuance->isFlag(lsfMPTCanTransfer)) + return tecNO_AUTH; } else if (vaultAsset.holds()) { diff --git a/src/xrpld/ledger/detail/View.cpp b/src/xrpld/ledger/detail/View.cpp index 94ab4b3570..3df323562f 100644 --- a/src/xrpld/ledger/detail/View.cpp +++ b/src/xrpld/ledger/detail/View.cpp @@ -1141,7 +1141,7 @@ addEmptyHolding( auto const& issuerId = issue.getIssuer(); auto const& currency = issue.currency; if (isGlobalFrozen(view, issuerId)) - return tecINTERNAL; // LCOV_EXCL_LINE + return tecFROZEN; // LCOV_EXCL_LINE auto const& srcId = issuerId; auto const& dstId = accountID; @@ -1185,7 +1185,7 @@ addEmptyHolding( auto const& mptID = mptIssue.getMptID(); auto const mpt = view.peek(keylet::mptIssuance(mptID)); if (!mpt) - return tecOBJECT_NOT_FOUND; + return tefINTERNAL; // LCOV_EXCL_LINE if (mpt->isFlag(lsfMPTLocked)) return tecLOCKED; if (view.peek(keylet::mptoken(mptID, accountID)))