mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-03 16:56:48 +00:00
Read/const_ref
This commit is contained in:
@@ -135,9 +135,9 @@ TER
|
||||
checkInsufficientReserve(
|
||||
ReadView const& view,
|
||||
STTx const& tx,
|
||||
std::shared_ptr<SLE const> accSle,
|
||||
SLE::const_ref accSle,
|
||||
STAmount const& accBalance,
|
||||
std::shared_ptr<SLE const> const& sponsorSle,
|
||||
SLE::const_ref sponsorSle,
|
||||
std::int32_t ownerCountDelta,
|
||||
std::int32_t accountCountDelta = 0);
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ xrpLiquid(ReadView const& view, AccountID const& id, std::int32_t ownerCountAdj,
|
||||
void
|
||||
adjustOwnerCount(
|
||||
ApplyView& view,
|
||||
std::shared_ptr<SLE> const& accountSle,
|
||||
std::shared_ptr<SLE> const& sponsorSle,
|
||||
SLE::ref accountSle,
|
||||
SLE::ref sponsorSle,
|
||||
std::int32_t amount,
|
||||
beast::Journal j);
|
||||
|
||||
@@ -54,7 +54,7 @@ adjustOwnerCount(
|
||||
adjustOwnerCount(
|
||||
view,
|
||||
view.peek(keylet::account(account)),
|
||||
sponsor ? view.peek(keylet::account(*sponsor)) : std::shared_ptr<SLE>(),
|
||||
sponsor ? view.peek(keylet::account(*sponsor)) : SLE::pointer(),
|
||||
amount,
|
||||
j);
|
||||
}
|
||||
@@ -93,9 +93,7 @@ getPseudoAccountFields();
|
||||
- null pointer
|
||||
*/
|
||||
[[nodiscard]] bool
|
||||
isPseudoAccount(
|
||||
std::shared_ptr<SLE const> sleAcct,
|
||||
std::set<SField const*> const& pseudoFieldFilter = {});
|
||||
isPseudoAccount(SLE::const_ref sleAcct, std::set<SField const*> const& pseudoFieldFilter = {});
|
||||
|
||||
/** Convenience overload that reads the account from the view. */
|
||||
[[nodiscard]] inline bool
|
||||
@@ -115,7 +113,7 @@ isPseudoAccount(
|
||||
* before using a field. The amendment check is **not** performed in
|
||||
* createPseudoAccount.
|
||||
*/
|
||||
[[nodiscard]] Expected<std::shared_ptr<SLE>, TER>
|
||||
[[nodiscard]] Expected<SLE::pointer, TER>
|
||||
createPseudoAccount(ApplyView& view, uint256 const& pseudoOwnerKey, SField const& ownerField);
|
||||
|
||||
/** Checks the destination and tag.
|
||||
|
||||
@@ -74,7 +74,7 @@ verifyDepositPreauth(
|
||||
ApplyView& view,
|
||||
AccountID const& src,
|
||||
AccountID const& dst,
|
||||
std::shared_ptr<SLE const> const& sleDst,
|
||||
SLE::const_ref sleDst,
|
||||
beast::Journal j);
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -34,7 +34,7 @@ getTxReserveSponsorAccountID(STTx const& tx)
|
||||
return {};
|
||||
}
|
||||
|
||||
inline std::shared_ptr<SLE>
|
||||
inline SLE::pointer
|
||||
getTxReserveSponsor(ApplyView& view, STTx const& tx)
|
||||
{
|
||||
auto const sponsorID = getTxReserveSponsorAccountID(tx);
|
||||
@@ -43,7 +43,7 @@ getTxReserveSponsor(ApplyView& view, STTx const& tx)
|
||||
return {};
|
||||
}
|
||||
|
||||
inline std::shared_ptr<SLE const>
|
||||
inline SLE::const_pointer
|
||||
getTxReserveSponsor(ReadView const& view, STTx const& tx)
|
||||
{
|
||||
auto const sponsorID = getTxReserveSponsorAccountID(tx);
|
||||
@@ -54,7 +54,7 @@ getTxReserveSponsor(ReadView const& view, STTx const& tx)
|
||||
|
||||
inline std::optional<AccountID>
|
||||
getLedgerEntryReserveSponsorAccountID(
|
||||
std::shared_ptr<SLE const> const& sle,
|
||||
SLE::const_ref sle,
|
||||
SF_ACCOUNT const& field = sfSponsor)
|
||||
{
|
||||
if (sle->isFieldPresent(field))
|
||||
@@ -62,10 +62,10 @@ getLedgerEntryReserveSponsorAccountID(
|
||||
return {};
|
||||
}
|
||||
|
||||
inline std::shared_ptr<SLE>
|
||||
inline SLE::pointer
|
||||
getLedgerEntryReserveSponsor(
|
||||
ApplyView& view,
|
||||
std::shared_ptr<SLE> const& sle,
|
||||
SLE::const_ref sle,
|
||||
SF_ACCOUNT const& field = sfSponsor)
|
||||
{
|
||||
auto const sponsorID = getLedgerEntryReserveSponsorAccountID(sle, field);
|
||||
@@ -74,10 +74,10 @@ getLedgerEntryReserveSponsor(
|
||||
return {};
|
||||
}
|
||||
|
||||
inline std::shared_ptr<SLE const>
|
||||
inline SLE::const_pointer
|
||||
getLedgerEntryReserveSponsor(
|
||||
ReadView const& view,
|
||||
std::shared_ptr<SLE const> const& sle,
|
||||
SLE::const_ref sle,
|
||||
SF_ACCOUNT const& field = sfSponsor)
|
||||
{
|
||||
auto const sponsorID = getLedgerEntryReserveSponsorAccountID(sle, field);
|
||||
@@ -88,8 +88,8 @@ getLedgerEntryReserveSponsor(
|
||||
|
||||
inline void
|
||||
addSponsorToLedgerEntry(
|
||||
std::shared_ptr<SLE> const& sle,
|
||||
std::shared_ptr<SLE> const& sponsorSle,
|
||||
SLE::ref sle,
|
||||
SLE::const_ref sponsorSle,
|
||||
SF_ACCOUNT const& field = sfSponsor)
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
@@ -101,7 +101,7 @@ addSponsorToLedgerEntry(
|
||||
}
|
||||
|
||||
inline void
|
||||
removeSponsorFromLedgerEntry(std::shared_ptr<SLE> const& sle, SF_ACCOUNT const& field = sfSponsor)
|
||||
removeSponsorFromLedgerEntry(SLE::ref sle, SF_ACCOUNT const& field = sfSponsor)
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
(sle->getType() == ltRIPPLE_STATE && (field == sfHighSponsor || field == sfLowSponsor)) ||
|
||||
|
||||
@@ -301,7 +301,7 @@ hashOfSeq(ReadView const& ledger, LedgerIndex seq, beast::Journal journal)
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ownerCount(std::shared_ptr<SLE const> const& sponsorSle)
|
||||
ownerCount(SLE::const_ref sponsorSle)
|
||||
{
|
||||
auto const ownerCount = sponsorSle->getFieldU32(sfOwnerCount);
|
||||
auto const sponsoredOwnerCount = sponsorSle->getFieldU32(sfSponsoredOwnerCount);
|
||||
@@ -311,7 +311,7 @@ ownerCount(std::shared_ptr<SLE const> const& sponsorSle)
|
||||
}
|
||||
|
||||
XRPAmount
|
||||
calculateReserve(std::shared_ptr<SLE const> const& sle, Fees const& fees)
|
||||
calculateReserve(SLE::const_ref sle, Fees const& fees)
|
||||
{
|
||||
XRPL_ASSERT(sle->getType() == ltACCOUNT_ROOT, "xrpl::calculateReserve : valid sle type");
|
||||
|
||||
@@ -327,9 +327,9 @@ TER
|
||||
checkInsufficientReserve(
|
||||
ReadView const& view,
|
||||
STTx const& tx,
|
||||
std::shared_ptr<SLE const> accSle,
|
||||
SLE::const_ref accSle,
|
||||
STAmount const& accBalance,
|
||||
std::shared_ptr<SLE const> const& sponsorSle,
|
||||
SLE::const_ref sponsorSle,
|
||||
std::int32_t ownerCountDelta,
|
||||
std::int32_t accountCountDelta)
|
||||
{
|
||||
|
||||
@@ -134,10 +134,10 @@ transferRate(ReadView const& view, AccountID const& issuer)
|
||||
return parityRate;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
adjustSponsorOwnerCountHlp(
|
||||
ApplyView& view,
|
||||
std::shared_ptr<SLE> const& sle,
|
||||
SLE::ref sle,
|
||||
SField const& sfield,
|
||||
std::int32_t amount,
|
||||
beast::Journal j)
|
||||
@@ -160,8 +160,8 @@ adjustSponsorOwnerCountHlp(
|
||||
void
|
||||
adjustOwnerCount(
|
||||
ApplyView& view,
|
||||
std::shared_ptr<SLE> const& accountSle,
|
||||
std::shared_ptr<SLE> const& sponsorSle,
|
||||
SLE::ref accountSle,
|
||||
SLE::ref sponsorSle,
|
||||
std::int32_t amount,
|
||||
beast::Journal j)
|
||||
{
|
||||
@@ -258,9 +258,7 @@ getPseudoAccountFields()
|
||||
}
|
||||
|
||||
[[nodiscard]] bool
|
||||
isPseudoAccount(
|
||||
std::shared_ptr<SLE const> sleAcct,
|
||||
std::set<SField const*> const& pseudoFieldFilter)
|
||||
isPseudoAccount(SLE::const_ref sleAcct, std::set<SField const*> const& pseudoFieldFilter)
|
||||
{
|
||||
auto const& fields = getPseudoAccountFields();
|
||||
|
||||
@@ -274,7 +272,7 @@ isPseudoAccount(
|
||||
}) > 0;
|
||||
}
|
||||
|
||||
Expected<std::shared_ptr<SLE>, TER>
|
||||
Expected<SLE::pointer, TER>
|
||||
createPseudoAccount(ApplyView& view, uint256 const& pseudoOwnerKey, SField const& ownerField)
|
||||
{
|
||||
[[maybe_unused]]
|
||||
|
||||
@@ -348,7 +348,7 @@ verifyDepositPreauth(
|
||||
ApplyView& view,
|
||||
AccountID const& src,
|
||||
AccountID const& dst,
|
||||
std::shared_ptr<SLE const> const& sleDst,
|
||||
SLE::const_ref sleDst,
|
||||
beast::Journal j)
|
||||
{
|
||||
// If depositPreauth is enabled, then an account that requires
|
||||
|
||||
Reference in New Issue
Block a user