mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-03 16:56:48 +00:00
Fix clang-format, some refactoring
This commit is contained in:
@@ -40,15 +40,15 @@ xrpLiquid(ReadView const& view, AccountID const& id, std::int32_t ownerCountAdj,
|
||||
(ownerCount + "sponsoring object count" - "sponsored object count" + additionalOwnerCount) *
|
||||
increment + (1 if not sponsored account + sponsoringAccountCount) * "reserve base"
|
||||
*/
|
||||
XRPAmount
|
||||
[[nodiscard]] XRPAmount
|
||||
accountReserve(
|
||||
ReadView const& view,
|
||||
std::shared_ptr<SLE const> const& sle,
|
||||
SLE::const_ref sle,
|
||||
beast::Journal j,
|
||||
std::int32_t ownerCountAdj = 0,
|
||||
std::int32_t reserveCountAdj = 0);
|
||||
|
||||
inline XRPAmount
|
||||
[[nodiscard]] inline XRPAmount
|
||||
accountReserve(
|
||||
ReadView const& view,
|
||||
AccountID const& id,
|
||||
@@ -76,7 +76,7 @@ checkInsufficientReserve(
|
||||
std::uint32_t
|
||||
ownerCount(
|
||||
ReadView const& view,
|
||||
std::shared_ptr<SLE const> const& sle,
|
||||
SLE::const_ref sle,
|
||||
beast::Journal j,
|
||||
std::int32_t ownerCountAdj = 0);
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ enum LedgerEntryType : std::uint16_t {
|
||||
LSF_FLAG(lsfDisallowIncomingPayChan, 0x10000000) /* True, reject new paychans */ \
|
||||
LSF_FLAG(lsfDisallowIncomingTrustline, 0x20000000) /* True, reject new trustlines (only if no issued assets) */ \
|
||||
LSF_FLAG(lsfAllowTrustLineLocking, 0x40000000) /* True, enable trustline locking */ \
|
||||
LSF_FLAG(lsfAllowTrustLineClawback, 0x80000000)) /* True, enable clawback */ \
|
||||
LSF_FLAG(lsfAllowTrustLineClawback, 0x80000000)) /* True, enable clawback */ \
|
||||
\
|
||||
LEDGER_OBJECT(Offer, \
|
||||
LSF_FLAG(lsfPassive, 0x00010000) \
|
||||
@@ -203,7 +203,7 @@ enum LedgerEntryType : std::uint16_t {
|
||||
LSF_FLAG(lsfLoanImpaired, 0x00020000) \
|
||||
LSF_FLAG(lsfLoanOverpayment, 0x00040000)) /* True, loan allows overpayments */ \
|
||||
\
|
||||
LEDGER_OBJECT(Sponsorship, \
|
||||
LEDGER_OBJECT(Sponsorship, \
|
||||
LSF_FLAG(lsfSponsorshipRequireSignForFee, 0x00010000) \
|
||||
LSF_FLAG(lsfSponsorshipRequireSignForReserve, 0x00020000))
|
||||
|
||||
|
||||
@@ -22,8 +22,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
calculateOracleReserve(std::size_t count);
|
||||
inline static uint32_t
|
||||
calculateOracleReserve(std::size_t count)
|
||||
{
|
||||
return count > 5 ? 2 : 1;
|
||||
}
|
||||
|
||||
static NotTEC
|
||||
preflight(PreflightContext const& ctx);
|
||||
|
||||
@@ -88,7 +88,7 @@ confineOwnerCount(
|
||||
static std::uint32_t
|
||||
ownerCountHlp(
|
||||
ReadView const& view,
|
||||
std::shared_ptr<SLE const> const& sle,
|
||||
SLE::const_ref sle,
|
||||
std::int32_t adjustment,
|
||||
bool reportConfine,
|
||||
beast::Journal j)
|
||||
@@ -129,7 +129,7 @@ ownerCountHlp(
|
||||
}
|
||||
|
||||
static std::uint32_t
|
||||
reserveCountHlp(std::shared_ptr<SLE const> const& sle, std::int32_t adjustment, beast::Journal j)
|
||||
reserveCountHlp(SLE::const_ref sle, std::int32_t adjustment, beast::Journal j)
|
||||
{
|
||||
bool const isSponsored = sle->isFieldPresent(sfSponsor);
|
||||
std::uint32_t const sponsoringCount = sle->getFieldU32(sfSponsoringAccountCount);
|
||||
@@ -167,7 +167,7 @@ baseReserveHlp(ReadView const& view, std::uint32_t ownerCount, std::uint32_t res
|
||||
static XRPAmount
|
||||
reserveHlp(
|
||||
ReadView const& view,
|
||||
std::shared_ptr<SLE const> const& sle,
|
||||
SLE::const_ref sle,
|
||||
std::uint32_t ownerCount,
|
||||
std::uint32_t reserveCount)
|
||||
{
|
||||
@@ -180,11 +180,7 @@ reserveHlp(
|
||||
}
|
||||
|
||||
std::uint32_t
|
||||
ownerCount(
|
||||
ReadView const& view,
|
||||
std::shared_ptr<SLE const> const& sle,
|
||||
beast::Journal j,
|
||||
std::int32_t adjustment)
|
||||
ownerCount(ReadView const& view, SLE::const_ref sle, beast::Journal j, std::int32_t adjustment)
|
||||
{
|
||||
return ownerCountHlp(view, sle, adjustment, true, j);
|
||||
}
|
||||
@@ -278,10 +274,10 @@ adjustOwnerCount(
|
||||
adjustSponsorOwnerCountHlp(view, accountSle, sfOwnerCount, accountID, adjustment, j);
|
||||
}
|
||||
|
||||
[[nodiscard]] XRPAmount
|
||||
XRPAmount
|
||||
accountReserve(
|
||||
ReadView const& view,
|
||||
std::shared_ptr<SLE const> const& sle,
|
||||
SLE::const_ref sle,
|
||||
beast::Journal j,
|
||||
std::int32_t ownerCountAdj,
|
||||
std::int32_t reserveCountAdj)
|
||||
|
||||
@@ -167,19 +167,9 @@ preflightCheckSimulateKeys(ApplyFlags flags, STObject const& sigObject, beast::J
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/** Performs early sanity checks on the account and fee fields */
|
||||
NotTEC
|
||||
Transactor::preflight1(PreflightContext const& ctx, std::uint32_t flagMask)
|
||||
static NotTEC
|
||||
preflight1Sponsor(PreflightContext const& ctx, AccountID const& id)
|
||||
{
|
||||
if (ctx.tx.isFieldPresent(sfDelegate))
|
||||
{
|
||||
if (!ctx.rules.enabled(featurePermissionDelegationV1_1))
|
||||
return temDISABLED;
|
||||
|
||||
if (ctx.tx[sfDelegate] == ctx.tx[sfAccount])
|
||||
return temBAD_SIGNER;
|
||||
}
|
||||
|
||||
bool const hasSponsor = ctx.tx.isFieldPresent(sfSponsor);
|
||||
bool const hasSponsorFlags = ctx.tx.isFieldPresent(sfSponsorFlags);
|
||||
bool const hasSponsorSig = ctx.tx.isFieldPresent(sfSponsorSignature);
|
||||
@@ -223,6 +213,29 @@ Transactor::preflight1(PreflightContext const& ctx, std::uint32_t flagMask)
|
||||
return temINVALID_FLAG;
|
||||
}
|
||||
|
||||
if (hasSponsor && ctx.tx.getAccountID(sfSponsor) == id)
|
||||
{
|
||||
JLOG(ctx.j.debug()) << "preflight1: Sponsor account cannot be the "
|
||||
"same as the transaction originator";
|
||||
return temMALFORMED;
|
||||
}
|
||||
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
/** Performs early sanity checks on the account and fee fields */
|
||||
NotTEC
|
||||
Transactor::preflight1(PreflightContext const& ctx, std::uint32_t flagMask)
|
||||
{
|
||||
if (ctx.tx.isFieldPresent(sfDelegate))
|
||||
{
|
||||
if (!ctx.rules.enabled(featurePermissionDelegationV1_1))
|
||||
return temDISABLED;
|
||||
|
||||
if (ctx.tx[sfDelegate] == ctx.tx[sfAccount])
|
||||
return temBAD_SIGNER;
|
||||
}
|
||||
|
||||
if (auto const ret = preflight0(ctx, flagMask))
|
||||
return ret;
|
||||
|
||||
@@ -261,13 +274,8 @@ Transactor::preflight1(PreflightContext const& ctx, std::uint32_t flagMask)
|
||||
!ctx.rules.enabled(featureBatch),
|
||||
"Inner batch transaction must have a parent batch ID.");
|
||||
|
||||
// Sponsor checks
|
||||
if (hasSponsor && ctx.tx.getAccountID(sfSponsor) == id)
|
||||
{
|
||||
JLOG(ctx.j.debug()) << "preflight1: Sponsor account cannot be the "
|
||||
"same as the transaction originator";
|
||||
return temMALFORMED;
|
||||
}
|
||||
if (auto const ter = preflight1Sponsor(ctx, id); !isTesSuccess(ter))
|
||||
return ter;
|
||||
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
@@ -59,12 +59,6 @@ OracleSet::preflight(PreflightContext const& ctx)
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
OracleSet::calculateOracleReserve(std::size_t count)
|
||||
{
|
||||
return count > 5 ? 2 : 1;
|
||||
}
|
||||
|
||||
TER
|
||||
OracleSet::preclaim(PreclaimContext const& ctx)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user