mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-23 07:10:53 +00:00
Optimise isFrozen check for pair of accounts
This commit is contained in:
@@ -486,8 +486,7 @@ Payment::doApply()
|
||||
// - can't send between holders
|
||||
// - holder can send back to issuer
|
||||
// - issuer can send to holder
|
||||
if (isFrozen(view(), account_, mptIssue) ||
|
||||
isFrozen(view(), dstAccountID, mptIssue))
|
||||
if (isAnyFrozen(view(), account_, dstAccountID, mptIssue))
|
||||
return tecLOCKED;
|
||||
|
||||
// Get the rate for a payment between the holders.
|
||||
|
||||
@@ -154,6 +154,49 @@ isFrozen(ReadView const& view, AccountID const& account, Asset const& asset)
|
||||
asset.value());
|
||||
}
|
||||
|
||||
[[nodiscard]] bool
|
||||
isAnyFrozen(
|
||||
ReadView const& view,
|
||||
AccountID const& account1,
|
||||
AccountID const& account2,
|
||||
MPTIssue const& mptIssue);
|
||||
|
||||
/*
|
||||
We do not have use a case for these (yet ?)
|
||||
|
||||
[[nodiscard]] bool
|
||||
isAnyFrozen(
|
||||
ReadView const& view,
|
||||
AccountID const& account1,
|
||||
AccountID const& account2,
|
||||
Currency const& currency,
|
||||
AccountID const& issuer);
|
||||
|
||||
[[nodiscard]] inline bool
|
||||
isAnyFrozen(
|
||||
ReadView const& view,
|
||||
AccountID const& account1,
|
||||
AccountID const& account2,
|
||||
Issue const& issue)
|
||||
{
|
||||
return isAnyFrozen(view, account1, account2, issue.currency, issue.account);
|
||||
}
|
||||
|
||||
[[nodiscard]] inline bool
|
||||
isAnyFrozen(
|
||||
ReadView const& view,
|
||||
AccountID const& account1,
|
||||
AccountID const& account2,
|
||||
Asset const& asset)
|
||||
{
|
||||
return std::visit(
|
||||
[&](auto const& issue) {
|
||||
return isAnyFrozen(view, account1, account2, issue);
|
||||
},
|
||||
asset.value());
|
||||
}
|
||||
*/
|
||||
|
||||
[[nodiscard]] bool
|
||||
isDeepFrozen(
|
||||
ReadView const& view,
|
||||
|
||||
@@ -280,6 +280,19 @@ isFrozen(
|
||||
isVaultPseudoAccountFrozen(view, mptIssue);
|
||||
}
|
||||
|
||||
[[nodiscard]] bool
|
||||
isAnyFrozen(
|
||||
ReadView const& view,
|
||||
AccountID const& account1,
|
||||
AccountID const& account2,
|
||||
MPTIssue const& mptIssue)
|
||||
{
|
||||
return isGlobalFrozen(view, mptIssue) ||
|
||||
isIndividualFrozen(view, account1, mptIssue) ||
|
||||
isIndividualFrozen(view, account2, mptIssue) ||
|
||||
isVaultPseudoAccountFrozen(view, mptIssue);
|
||||
}
|
||||
|
||||
bool
|
||||
isVaultPseudoAccountFrozen(ReadView const& view, MPTIssue const& mptShare)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user