mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-23 23:20:33 +00:00
Clean up the code
This commit is contained in:
@@ -18,11 +18,6 @@ namespace xrpl {
|
||||
|
||||
class LoanSet : public Transactor
|
||||
{
|
||||
private:
|
||||
/* Returns true if the transaction is using the two-step (Borrower) flow. */
|
||||
static bool
|
||||
isTwoStepFlow(STTx const& tx, Rules const& rules);
|
||||
|
||||
public:
|
||||
static constexpr auto kConsequencesFactory = ConsequencesFactoryType::Normal;
|
||||
|
||||
|
||||
@@ -49,19 +49,6 @@ LoanSet::getFlagsMask(PreflightContext const& ctx)
|
||||
return tfLoanSetMask;
|
||||
}
|
||||
|
||||
bool
|
||||
LoanSet::isTwoStepFlow(STTx const& tx, Rules const& rules)
|
||||
{
|
||||
if (!rules.enabled(featureLendingProtocolV1_1))
|
||||
return false;
|
||||
|
||||
// The two-step (Borrower) flow is started when the LoanSet names a
|
||||
// Borrower and a StartDate but carries neither a Counterparty nor a
|
||||
// CounterpartySignature.
|
||||
return tx.isFieldPresent(sfBorrower) && tx.isFieldPresent(sfStartDate) &&
|
||||
!tx.isFieldPresent(sfCounterparty) && !tx.isFieldPresent(sfCounterpartySignature);
|
||||
}
|
||||
|
||||
NotTEC
|
||||
LoanSet::preflight(PreflightContext const& ctx)
|
||||
{
|
||||
@@ -85,12 +72,7 @@ LoanSet::preflight(PreflightContext const& ctx)
|
||||
return tx.getFieldObject(sfCounterpartySignature);
|
||||
return std::nullopt;
|
||||
}();
|
||||
|
||||
bool twoStepFlow = isTwoStepFlow(tx, ctx.rules);
|
||||
// In the two-step (Borrower) flow introduced by V1.1, a CounterpartySignature
|
||||
// is not required even for non-batch transactions. The immediate flow still
|
||||
// requires one.
|
||||
if (!tx.isFlag(tfInnerBatchTxn) && !counterPartySig && !twoStepFlow)
|
||||
if (!tx.isFlag(tfInnerBatchTxn) && !counterPartySig)
|
||||
{
|
||||
JLOG(ctx.j.warn()) << "LoanSet transaction must have a CounterpartySignature.";
|
||||
return temBAD_SIGNER;
|
||||
@@ -161,11 +143,6 @@ LoanSet::checkSign(PreclaimContext const& ctx)
|
||||
if (auto ret = Transactor::checkSign(ctx))
|
||||
return ret;
|
||||
|
||||
// In the two-step (Borrower) flow introduced by V1.1 there is no
|
||||
// counterparty, so there is no CounterpartySignature to check.
|
||||
if (isTwoStepFlow(ctx.tx, ctx.view.rules()))
|
||||
return tesSUCCESS;
|
||||
|
||||
// Counter signer is optional. If it's not specified, it's assumed to be
|
||||
// `LoanBroker.Owner`. Note that we have not checked whether the
|
||||
// loanbroker exists at this point.
|
||||
|
||||
Reference in New Issue
Block a user