Review feedback from @gregtatcam: frozen broker pseudo-account

- LoanSet needs to fail if the broker pseudo-account is deep frozen,
  because it needs to be able to receive fees if the broker owner can't.
This commit is contained in:
Ed Hennis
2025-11-22 23:45:39 -05:00
parent 1ceff3dde7
commit a3b2ce91de

View File

@@ -266,6 +266,7 @@ LoanSet::preclaim(PreclaimContext const& ctx)
"of the LoanBroker.";
return tecNO_PERMISSION;
}
auto const brokerPseudo = brokerSle->at(sfAccount);
auto const borrower = counterparty == brokerOwner ? account : counterparty;
if (auto const borrowerSle = ctx.view.read(keylet::account(borrower));
@@ -312,6 +313,16 @@ LoanSet::preclaim(PreclaimContext const& ctx)
JLOG(ctx.j.warn()) << "Vault pseudo-account is frozen.";
return ret;
}
// brokerPseudo is the fallback account to receive LoanPay fees, even if the
// broker owner is unable to accept them. Don't create the loan if it is
// deep frozen.
if (auto const ret = checkDeepFrozen(ctx.view, brokerPseudo, asset))
{
JLOG(ctx.j.warn()) << "Broker pseudo-account is frozen.";
return ret;
}
// borrower is eventually going to have to pay back the loan, so it can't be
// frozen now. It is also going to receive funds, so it can't be deep
// frozen, but being frozen is a prerequisite for being deep frozen, so