Disallow pseudo accounts to be Destination for LoanBrokerCoverWithdraw (#6106)

This commit is contained in:
Jingchen
2025-12-17 16:34:29 +00:00
committed by GitHub
parent 0aa4eed0f7
commit 14790724af
3 changed files with 12 additions and 1 deletions

View File

@@ -655,7 +655,7 @@ createPseudoAccount(
uint256 const& pseudoOwnerKey,
SField const& ownerField);
// Returns true iff sleAcct is a pseudo-account or specific
// Returns true if and only if sleAcct is a pseudo-account or specific
// pseudo-accounts in pseudoFieldFilter.
//
// Returns false if sleAcct is

View File

@@ -1024,6 +1024,12 @@ class LoanBroker_test : public beast::unit_test::suite
destination(dest),
ter(tecFROZEN),
THISLINE);
// preclaim: tecPSEUDO_ACCOUNT
env(coverWithdraw(alice, brokerKeylet.key, asset(10)),
destination(vaultInfo.pseudoAccount),
ter(tecPSEUDO_ACCOUNT),
THISLINE);
}
if (brokerTest == CoverClawback)

View File

@@ -48,6 +48,11 @@ LoanBrokerCoverWithdraw::preclaim(PreclaimContext const& ctx)
auto const dstAcct = tx[~sfDestination].value_or(account);
if (isPseudoAccount(ctx.view, dstAcct))
{
JLOG(ctx.j.warn()) << "Trying to withdraw into a pseudo-account.";
return tecPSEUDO_ACCOUNT;
}
auto const sleBroker = ctx.view.read(keylet::loanbroker(brokerID));
if (!sleBroker)
{