Switch auth mode to weak when submitter is destination

This commit is contained in:
Bronek Kozicki
2025-11-10 18:28:08 +00:00
parent 6db3e32d68
commit ed9567d861
2 changed files with 13 additions and 5 deletions

View File

@@ -74,7 +74,7 @@ LoanBrokerCoverWithdraw::preclaim(PreclaimContext const& ctx)
// Withdrawal to a 3rd party destination account is essentially a transfer. // Withdrawal to a 3rd party destination account is essentially a transfer.
// Enforce all the usual asset transfer checks. // Enforce all the usual asset transfer checks.
AuthType authType = AuthType::Legacy; AuthType authType = AuthType::WeakAuth;
if (account != dstAcct) if (account != dstAcct)
{ {
if (auto const ret = canWithdraw(ctx.view, tx)) if (auto const ret = canWithdraw(ctx.view, tx))
@@ -144,8 +144,16 @@ LoanBrokerCoverWithdraw::doApply()
broker->at(sfCoverAvailable) -= amount; broker->at(sfCoverAvailable) -= amount;
view().update(broker); view().update(broker);
// Move the funds from the broker's pseudo-account to the dstAcct // Create trust line or MPToken for the receiving account
if (dstAcct == account_)
{
if (auto const ter = addEmptyHolding(
view(), account_, mPriorBalance, amount.asset(), j_);
!isTesSuccess(ter) && ter != tecDUPLICATE)
return ter;
}
// Move the funds from the broker's pseudo-account to the dstAcct
if (dstAcct == account_ || amount.native()) if (dstAcct == account_ || amount.native())
{ {
// Transfer assets directly from pseudo-account to depositor. // Transfer assets directly from pseudo-account to depositor.

View File

@@ -247,9 +247,9 @@ VaultWithdraw::doApply()
} }
auto const dstAcct = ctx_.tx[~sfDestination].value_or(account_); auto const dstAcct = ctx_.tx[~sfDestination].value_or(account_);
if (!vaultAsset.native() && //
dstAcct != vaultAsset.getIssuer() && // // Create trust line or MPToken for the receiving account
dstAcct == account_) if (dstAcct == account_)
{ {
if (auto const ter = addEmptyHolding( if (auto const ter = addEmptyHolding(
view(), account_, mPriorBalance, vaultAsset, j_); view(), account_, mPriorBalance, vaultAsset, j_);