mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-19 10:35:50 +00:00
Fix broken Vault unit tests introduced in 6adb2ec
- canSendToAccount will check if a destination tag is required _before_ checking if the sender is the destination. This is the original VaultWithdraw behavior, and I want to stay consistent.
This commit is contained in:
@@ -730,6 +730,7 @@ checkDestinationAndTag(SLE::const_ref toSle, bool hasDestinationTag);
|
||||
canSendToAccount(
|
||||
AccountID const& from,
|
||||
ReadView const& view,
|
||||
AccountID const& to,
|
||||
SLE::const_ref toSle,
|
||||
bool hasDestinationTag);
|
||||
|
||||
|
||||
@@ -1378,15 +1378,19 @@ checkDestinationAndTag(SLE::const_ref toSle, bool hasDestinationTag)
|
||||
canSendToAccount(
|
||||
AccountID const& from,
|
||||
ReadView const& view,
|
||||
AccountID const& to,
|
||||
SLE::const_ref toSle,
|
||||
bool hasDestinationTag)
|
||||
{
|
||||
if (auto const ret = checkDestinationAndTag(toSle, hasDestinationTag))
|
||||
return ret;
|
||||
|
||||
if (from == to)
|
||||
return tesSUCCESS;
|
||||
|
||||
if (toSle->isFlag(lsfDepositAuth))
|
||||
{
|
||||
if (!view.exists(keylet::depositPreauth(toSle->at(sfAccount), from)))
|
||||
if (!view.exists(keylet::depositPreauth(to, from)))
|
||||
return tecNO_PERMISSION;
|
||||
}
|
||||
|
||||
@@ -1401,10 +1405,8 @@ canSendToAccount(
|
||||
bool hasDestinationTag)
|
||||
{
|
||||
auto const toSle = view.read(keylet::account(to));
|
||||
if (from == to)
|
||||
return toSle ? (TER)tesSUCCESS : (TER)tecINTERNAL;
|
||||
|
||||
return canSendToAccount(from, view, toSle, hasDestinationTag);
|
||||
return canSendToAccount(from, view, to, toSle, hasDestinationTag);
|
||||
}
|
||||
|
||||
[[nodiscard]] TER
|
||||
|
||||
Reference in New Issue
Block a user