mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Merge branch 'ximinez/lending-refactoring-4' into ximinez/lending-XLS-66
This commit is contained in:
@@ -673,7 +673,8 @@ isTerRetry(TER x) noexcept
|
||||
inline bool
|
||||
isTesSuccess(TER x) noexcept
|
||||
{
|
||||
return (x == tesSUCCESS);
|
||||
// Makes use of TERSubset::operator bool()
|
||||
return !(x);
|
||||
}
|
||||
|
||||
inline bool
|
||||
|
||||
@@ -241,7 +241,6 @@ Batch::preflight(PreflightContext const& ctx)
|
||||
}
|
||||
|
||||
// Validation Inner Batch Txns
|
||||
std::unordered_set<AccountID> requiredSigners;
|
||||
std::unordered_set<uint256> uniqueHashes;
|
||||
std::unordered_map<AccountID, std::unordered_set<std::uint32_t>>
|
||||
accountSeqTicket;
|
||||
@@ -396,6 +395,23 @@ Batch::preflight(PreflightContext const& ctx)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
NotTEC
|
||||
Batch::preflightSigValidated(PreflightContext const& ctx)
|
||||
{
|
||||
auto const parentBatchId = ctx.tx.getTransactionID();
|
||||
auto const outerAccount = ctx.tx.getAccountID(sfAccount);
|
||||
auto const& rawTxns = ctx.tx.getFieldArray(sfRawTransactions);
|
||||
|
||||
// Build the signers list
|
||||
std::unordered_set<AccountID> requiredSigners;
|
||||
for (STObject const& rb : rawTxns)
|
||||
{
|
||||
auto const innerAccount = rb.getAccountID(sfAccount);
|
||||
|
||||
// If the inner account is the same as the outer account, do not add the
|
||||
// inner account to the required signers set.
|
||||
|
||||
@@ -49,6 +49,9 @@ public:
|
||||
static NotTEC
|
||||
preflight(PreflightContext const& ctx);
|
||||
|
||||
static NotTEC
|
||||
preflightSigValidated(PreflightContext const& ctx);
|
||||
|
||||
static NotTEC
|
||||
checkSign(PreclaimContext const& ctx);
|
||||
|
||||
|
||||
@@ -650,6 +650,15 @@ EscrowFinish::preflight(PreflightContext const& ctx)
|
||||
if (static_cast<bool>(cb) != static_cast<bool>(fb))
|
||||
return temMALFORMED;
|
||||
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
NotTEC
|
||||
EscrowFinish::preflightSigValidated(PreflightContext const& ctx)
|
||||
{
|
||||
auto const cb = ctx.tx[~sfCondition];
|
||||
auto const fb = ctx.tx[~sfFulfillment];
|
||||
|
||||
if (cb && fb)
|
||||
{
|
||||
auto& router = ctx.app.getHashRouter();
|
||||
|
||||
@@ -69,6 +69,9 @@ public:
|
||||
static NotTEC
|
||||
preflight(PreflightContext const& ctx);
|
||||
|
||||
static NotTEC
|
||||
preflightSigValidated(PreflightContext const& ctx);
|
||||
|
||||
static XRPAmount
|
||||
calculateBaseFee(ReadView const& view, STTx const& tx);
|
||||
|
||||
|
||||
@@ -272,6 +272,12 @@ Transactor::getFlagsMask(PreflightContext const& ctx)
|
||||
return tfUniversalMask;
|
||||
}
|
||||
|
||||
NotTEC
|
||||
Transactor::preflightSigValidated(PreflightContext const& ctx)
|
||||
{
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
TER
|
||||
Transactor::checkPermission(ReadView const& view, STTx const& tx)
|
||||
{
|
||||
|
||||
@@ -215,6 +215,10 @@ public:
|
||||
static NotTEC
|
||||
preflight(PreflightContext const& ctx);
|
||||
|
||||
// Optional, rarely needed, if the transaction does any expensive
|
||||
// checks after the signature is verified.
|
||||
static NotTEC preflightSigValidated(PreflightContext const& ctx);
|
||||
|
||||
* Do not try to call preflight1 or preflight2 directly.
|
||||
* Do not check whether relevant amendments are enabled in preflight.
|
||||
Instead, define isEnabled.
|
||||
@@ -290,6 +294,10 @@ protected:
|
||||
static std::uint32_t
|
||||
getFlagsMask(PreflightContext const& ctx);
|
||||
|
||||
// Base class always returns tesSUCCESS
|
||||
static NotTEC
|
||||
preflightSigValidated(PreflightContext const& ctx);
|
||||
|
||||
static bool
|
||||
validDataLength(std::optional<Slice> const& slice, std::size_t maxLength);
|
||||
|
||||
@@ -396,7 +404,10 @@ Transactor::invokePreflight(PreflightContext const& ctx)
|
||||
if (auto const ret = T::preflight(ctx))
|
||||
return ret;
|
||||
|
||||
return preflight2(ctx);
|
||||
if (auto const ret = preflight2(ctx))
|
||||
return ret;
|
||||
|
||||
return T::preflightSigValidated(ctx);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
||||
Reference in New Issue
Block a user