mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-30 10:30:22 +00:00
more fixes
This commit is contained in:
@@ -71,6 +71,29 @@ public:
|
||||
*/
|
||||
[[nodiscard]] TER
|
||||
checkDestinationAndTag(bool hasDestinationTag) const;
|
||||
|
||||
/** Returns true if and only if sleAcct is a pseudo-account or specific
|
||||
pseudo-accounts in pseudoFieldFilter.
|
||||
|
||||
Returns false if sleAcct is:
|
||||
- NOT a pseudo-account OR
|
||||
- NOT a ltACCOUNT_ROOT OR
|
||||
- null pointer
|
||||
*/
|
||||
[[nodiscard]] bool
|
||||
isPseudoAccount(std::set<SField const*> const& pseudoFieldFilter = {}) const;
|
||||
|
||||
[[nodiscard]] bool
|
||||
operator==(AccountRoot const& other) const
|
||||
{
|
||||
return id_ == other.id_;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool
|
||||
operator==(AccountID const& other) const
|
||||
{
|
||||
return id_ == other;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -84,7 +107,7 @@ class WritableAccountRoot : public AccountRoot, public WritableSLE
|
||||
{
|
||||
public:
|
||||
WritableAccountRoot(AccountID const& id, ApplyView& view)
|
||||
: AccountRoot(id, view), WritableSLE(view.peek(keylet::account(id)), view)
|
||||
: AccountRoot(id, view), WritableSLE(keylet::account(id), view)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -136,7 +159,10 @@ isPseudoAccount(
|
||||
AccountID const& accountId,
|
||||
std::set<SField const*> const& pseudoFieldFilter = {})
|
||||
{
|
||||
return isPseudoAccount(view.read(keylet::account(accountId)), pseudoFieldFilter);
|
||||
AccountRoot const acct(accountId, view);
|
||||
if (!acct)
|
||||
return false;
|
||||
return acct.isPseudoAccount(pseudoFieldFilter);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <xrpl/beast/utility/Journal.h>
|
||||
#include <xrpl/ledger/ApplyView.h>
|
||||
#include <xrpl/ledger/ReadView.h>
|
||||
#include <xrpl/ledger/helpers/AccountRootHelpers.h>
|
||||
#include <xrpl/protocol/AccountID.h>
|
||||
#include <xrpl/protocol/STArray.h>
|
||||
#include <xrpl/protocol/STTx.h>
|
||||
@@ -73,8 +74,7 @@ verifyDepositPreauth(
|
||||
STTx const& tx,
|
||||
ApplyView& view,
|
||||
AccountID const& src,
|
||||
AccountID const& dst,
|
||||
std::shared_ptr<SLE const> const& sleDst,
|
||||
AccountRoot const& dst,
|
||||
beast::Journal j);
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -167,18 +167,34 @@ public:
|
||||
applyView_.update(mutableSle_);
|
||||
}
|
||||
|
||||
void
|
||||
newSLE()
|
||||
{
|
||||
XRPL_ASSERT(canModify(), "xrpl::WritableSLE::newSLE : can modify");
|
||||
mutableSle_ = std::make_shared<SLE>(key_);
|
||||
}
|
||||
|
||||
protected:
|
||||
// Default constructor is deleted (cannot leave reference uninitialized)
|
||||
WritableSLE() = delete;
|
||||
|
||||
/** Constructor for read-write context (ApplyView) */
|
||||
explicit WritableSLE(std::shared_ptr<SLE> sle, ApplyView& view)
|
||||
: mutableSle_(std::move(sle)), applyView_(view)
|
||||
: applyView_(view)
|
||||
, key_(sle ? Keylet(sle->getType(), sle->key()) : Keylet(ltANY, uint256{}))
|
||||
, mutableSle_(std::move(sle))
|
||||
{
|
||||
}
|
||||
|
||||
/** Constructor for read-write context (ApplyView) */
|
||||
explicit WritableSLE(Keylet const& key, ApplyView& view)
|
||||
: applyView_(view), key_(key), mutableSle_(applyView_.peek(key))
|
||||
{
|
||||
}
|
||||
|
||||
ApplyView& applyView_; // ApplyView for write contexts (first for init order)
|
||||
Keylet const key_;
|
||||
std::shared_ptr<SLE> mutableSle_; // Mutable SLE for write contexts
|
||||
ApplyView& applyView_; // ApplyView for write contexts
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <xrpl/beast/utility/Journal.h>
|
||||
#include <xrpl/beast/utility/WrappedSink.h>
|
||||
#include <xrpl/ledger/helpers/AccountRootHelpers.h>
|
||||
#include <xrpl/protocol/Permissions.h>
|
||||
#include <xrpl/protocol/XRPAmount.h>
|
||||
#include <xrpl/tx/ApplyContext.h>
|
||||
@@ -113,7 +114,8 @@ protected:
|
||||
beast::WrappedSink sink_;
|
||||
beast::Journal const j_;
|
||||
|
||||
AccountID const account_;
|
||||
AccountID const accountID_;
|
||||
AccountRoot const account_;
|
||||
XRPAmount preFeeBalance_{}; // Balance before fees.
|
||||
|
||||
virtual ~Transactor() = default;
|
||||
|
||||
Reference in New Issue
Block a user