mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-19 02:25:52 +00:00
Minor cleanup
This commit is contained in:
@@ -78,21 +78,19 @@ deleteSLE(
|
||||
AccountID const& account, SField const& node, bool isOwner) -> TER {
|
||||
auto const sleAccount = view.peek(keylet::account(account));
|
||||
if (!sleAccount)
|
||||
{
|
||||
JLOG(j.fatal()) // LCOV_EXCL_LINE
|
||||
<< "Internal error: can't retrieve Owner account."; // LCOV_EXCL_LINE
|
||||
return tecINTERNAL; // LCOV_EXCL_LINE
|
||||
}
|
||||
{ // LCOV_EXCL_START
|
||||
JLOG(j.fatal()) << "Internal error: can't retrieve Owner account.";
|
||||
return tecINTERNAL;
|
||||
} // LCOV_EXCL_STOP
|
||||
|
||||
// Remove object from owner directory
|
||||
std::uint64_t const page = sleCredential->getFieldU64(node);
|
||||
if (!view.dirRemove(
|
||||
keylet::ownerDir(account), page, sleCredential->key(), false))
|
||||
{
|
||||
JLOG(j.fatal()) // LCOV_EXCL_LINE
|
||||
<< "Unable to delete Credential from owner."; // LCOV_EXCL_LINE
|
||||
return tefBAD_LEDGER; // LCOV_EXCL_LINE
|
||||
}
|
||||
{ // LCOV_EXCL_START
|
||||
JLOG(j.fatal()) << "Unable to delete Credential from owner.";
|
||||
return tefBAD_LEDGER;
|
||||
} // LCOV_EXCL_STOP
|
||||
|
||||
if (isOwner)
|
||||
adjustOwnerCount(view, sleAccount, -1, j);
|
||||
|
||||
@@ -797,8 +797,7 @@ canTransfer(
|
||||
ReadView const& view,
|
||||
MPTIssue const& mptIssue,
|
||||
AccountID const& from,
|
||||
AccountID const& to,
|
||||
int depth = 0);
|
||||
AccountID const& to);
|
||||
|
||||
/** Deleter function prototype. Returns the status of the entry deletion
|
||||
* (if should not be skipped) and if the entry should be skipped. The status
|
||||
|
||||
@@ -195,7 +195,7 @@ bool
|
||||
isGlobalFrozen(ReadView const& view, MPTIssue const& mptIssue)
|
||||
{
|
||||
if (auto const sle = view.read(keylet::mptIssuance(mptIssue.getMptID())))
|
||||
return sle->getFlags() & lsfMPTLocked;
|
||||
return sle->isFlag(lsfMPTLocked);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ isIndividualFrozen(
|
||||
{
|
||||
if (auto const sle =
|
||||
view.read(keylet::mptoken(mptIssue.getMptID(), account)))
|
||||
return sle->getFlags() & lsfMPTLocked;
|
||||
return sle->isFlag(lsfMPTLocked);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -306,38 +306,32 @@ isVaultPseudoAccountFrozen(
|
||||
if (!view.rules().enabled(featureSingleAssetVault))
|
||||
return false;
|
||||
|
||||
if (depth >= maxAssetCheckDepth)
|
||||
return true; // LCOV_EXCL_LINE
|
||||
|
||||
auto const mptIssuance =
|
||||
view.read(keylet::mptIssuance(mptShare.getMptID()));
|
||||
if (mptIssuance == nullptr)
|
||||
{
|
||||
UNREACHABLE( // LCOV_EXCL_LINE
|
||||
"ripple::isVaultPseudoAccountFrozen : null MPTokenIssuance"); // LCOV_EXCL_LINE
|
||||
return false; // LCOV_EXCL_LINE
|
||||
}
|
||||
return false; // zero MPToken won't block deletion of MPTokenIssuance
|
||||
|
||||
auto const issuer = mptIssuance->getAccountID(sfIssuer);
|
||||
auto const mptIssuer = view.read(keylet::account(issuer));
|
||||
if (mptIssuer == nullptr)
|
||||
{
|
||||
UNREACHABLE( // LCOV_EXCL_LINE
|
||||
"ripple::isVaultPseudoAccountFrozen : null MPToken issuer"); // LCOV_EXCL_LINE
|
||||
return false; // LCOV_EXCL_LINE
|
||||
}
|
||||
{ // LCOV_EXCL_START
|
||||
UNREACHABLE("ripple::isVaultPseudoAccountFrozen : null MPToken issuer");
|
||||
return false;
|
||||
} // LCOV_EXCL_STOP
|
||||
|
||||
if (!mptIssuer->isFieldPresent(sfVaultID))
|
||||
return false; // not a Vault pseudo-account, common case
|
||||
|
||||
if (depth >= maxAssetCheckDepth)
|
||||
return true; // LCOV_EXCL_LINE
|
||||
|
||||
auto const vault =
|
||||
view.read(keylet::vault(mptIssuer->getFieldH256(sfVaultID)));
|
||||
if (vault == nullptr)
|
||||
{
|
||||
UNREACHABLE( // LCOV_EXCL_LINE
|
||||
"ripple::isVaultPseudoAccountFrozen : null vault"); // LCOV_EXCL_LINE
|
||||
return false; // LCOV_EXCL_LINE
|
||||
}
|
||||
{ // LCOV_EXCL_START
|
||||
UNREACHABLE("ripple::isVaultPseudoAccountFrozen : null vault");
|
||||
return false;
|
||||
} // LCOV_EXCL_STOP
|
||||
|
||||
return isAnyFrozen(view, issuer, account, vault->at(sfAsset), depth + 1);
|
||||
}
|
||||
@@ -2299,6 +2293,9 @@ requireAuth(
|
||||
|
||||
if (view.rules().enabled(featureSingleAssetVault))
|
||||
{
|
||||
if (depth >= maxAssetCheckDepth)
|
||||
return tecINTERNAL; // LCOV_EXCL_LINE
|
||||
|
||||
// requireAuth is recursive if the issuer is a vault pseudo-account
|
||||
auto const sleIssuer = view.read(keylet::account(mptIssuer));
|
||||
if (!sleIssuer)
|
||||
@@ -2311,9 +2308,6 @@ requireAuth(
|
||||
if (!sleVault)
|
||||
return tefINTERNAL; // LCOV_EXCL_LINE
|
||||
|
||||
if (depth >= maxAssetCheckDepth)
|
||||
return tecINTERNAL; // LCOV_EXCL_LINE
|
||||
|
||||
auto const asset = sleVault->at(sfAsset);
|
||||
if (auto const err = std::visit(
|
||||
[&]<ValidIssueType TIss>(TIss const& issue) {
|
||||
@@ -2449,18 +2443,18 @@ enforceMPTokenAuthorization(
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
UNREACHABLE( // LCOV_EXCL_LINE
|
||||
"ripple::enforceMPTokenAuthorization : condition list is incomplete"); // LCOV_EXCL_LINE
|
||||
return tefINTERNAL; // LCOV_EXCL_LINE
|
||||
}
|
||||
// LCOV_EXCL_START
|
||||
UNREACHABLE(
|
||||
"ripple::enforceMPTokenAuthorization : condition list is incomplete");
|
||||
return tefINTERNAL;
|
||||
} // LCOV_EXCL_STOP
|
||||
|
||||
TER
|
||||
canTransfer(
|
||||
ReadView const& view,
|
||||
MPTIssue const& mptIssue,
|
||||
AccountID const& from,
|
||||
AccountID const& to,
|
||||
int depth)
|
||||
AccountID const& to)
|
||||
{
|
||||
auto const mptID = keylet::mptIssuance(mptIssue.getMptID());
|
||||
auto const sleIssuance = view.read(mptID);
|
||||
|
||||
Reference in New Issue
Block a user