diff --git a/include/xrpl/ledger/helpers/AccountRootHelpers.h b/include/xrpl/ledger/helpers/AccountRootHelpers.h index 5dfbc27662..61d0f33bd4 100644 --- a/include/xrpl/ledger/helpers/AccountRootHelpers.h +++ b/include/xrpl/ledger/helpers/AccountRootHelpers.h @@ -28,7 +28,7 @@ protected: AccountID const id_; public: - AccountRoot(AccountID const& id, ReadView const* view) + AccountRoot(AccountID const& id, ReadView const& view) : ReadOnlySLE(view->read(keylet::account(id)), view), id_(id) { } @@ -83,7 +83,7 @@ public: class WritableAccountRoot : public AccountRoot, public WritableSLE { public: - WritableAccountRoot(AccountID const& id, ApplyView* view) + WritableAccountRoot(AccountID const& id, ApplyView& view) : AccountRoot(id, view), WritableSLE(view->peek(keylet::account(id)), view) { } @@ -113,7 +113,7 @@ pseudoAccountAddress(ReadView const& view, uint256 const& pseudoOwnerKey); Pseudo-account designator fields MUST be maintained by including the SField::sMD_PseudoAccount flag in the SField definition. */ -[[nodiscard]] std::vector const& +[[nodiscard]] std::vector const& getPseudoAccountFields(); /** Returns true if and only if sleAcct is a pseudo-account or specific @@ -127,7 +127,7 @@ getPseudoAccountFields(); [[nodiscard]] bool isPseudoAccount( std::shared_ptr sleAcct, - std::set const& pseudoFieldFilter = {}); + std::set const& pseudoFieldFilter = {}); /** Convenience overload that reads the account from the view. */ [[nodiscard]] inline bool diff --git a/include/xrpl/ledger/helpers/WrappedSLEBase.h b/include/xrpl/ledger/helpers/WrappedSLEBase.h index 42e92e5af6..87f677ce09 100644 --- a/include/xrpl/ledger/helpers/WrappedSLEBase.h +++ b/include/xrpl/ledger/helpers/WrappedSLEBase.h @@ -53,7 +53,7 @@ public: } /** Returns the read view (always available) */ - ReadView const* + ReadView const& readView() const { return readView_; @@ -77,13 +77,13 @@ protected: ReadOnlySLE() = default; /** Constructor for read-only context (ReadView) */ - explicit ReadOnlySLE(std::shared_ptr sle, ReadView const* view) + explicit ReadOnlySLE(std::shared_ptr sle, ReadView const& view) : sle_(std::move(sle)), readView_(view) { } std::shared_ptr sle_; // Always valid (const view) - ReadView const* readView_; // Always valid + ReadView const& readView_; // Always valid }; /** @@ -123,7 +123,7 @@ public: } /** Returns the apply view for write operations */ - ApplyView* + ApplyView& applyView() const { return applyView_; @@ -174,7 +174,7 @@ protected: } std::shared_ptr mutableSle_; // Mutable SLE for write contexts - ApplyView* applyView_; // ApplyView for write contexts + ApplyView& applyView_; // ApplyView for write contexts }; } // namespace xrpl diff --git a/src/libxrpl/ledger/helpers/AccountRootHelpers.cpp b/src/libxrpl/ledger/helpers/AccountRootHelpers.cpp index b0e50bac83..7d03e0f20d 100644 --- a/src/libxrpl/ledger/helpers/AccountRootHelpers.cpp +++ b/src/libxrpl/ledger/helpers/AccountRootHelpers.cpp @@ -66,15 +66,15 @@ AccountRoot::xrpLiquid(std::int32_t ownerCountAdj, beast::Journal j) const { // Return balance minus reserve std::uint32_t const ownerCount = confineOwnerCount( - readView_->ownerCountHook(id_, sle_->getFieldU32(sfOwnerCount)), ownerCountAdj); + readView_.ownerCountHook(id_, sle_->getFieldU32(sfOwnerCount)), ownerCountAdj); // Pseudo-accounts have no reserve requirement auto const reserve = - isPseudoAccount(sle_) ? XRPAmount{0} : readView_->fees().accountReserve(ownerCount); + isPseudoAccount(sle_) ? XRPAmount{0} : readView_.fees().accountReserve(ownerCount); auto const fullBalance = sle_->getFieldAmount(sfBalance); - auto const balance = readView_->balanceHook(id_, xrpAccount(), fullBalance); + auto const balance = readView_.balanceHook(id_, xrpAccount(), fullBalance); STAmount const amount = (balance < reserve) ? STAmount{0} : balance - reserve; @@ -104,7 +104,7 @@ WritableAccountRoot::adjustOwnerCount(std::int32_t amount, beast::Journal j) std::uint32_t const current{mutableSle_->getFieldU32(sfOwnerCount)}; AccountID const id = (*mutableSle_)[sfAccount]; std::uint32_t const adjusted = confineOwnerCount(current, amount, id, j); - applyView_->adjustOwnerCountHook(id_, current, adjusted); + applyView_.adjustOwnerCountHook(id_, current, adjusted); mutableSle_->at(sfOwnerCount) = adjusted; update(); }