1#include <xrpl/basics/Log.h>
2#include <xrpl/basics/base_uint.h>
3#include <xrpl/basics/contract.h>
4#include <xrpl/basics/safe_cast.h>
5#include <xrpl/beast/utility/instrumentation.h>
6#include <xrpl/json/to_string.h>
7#include <xrpl/protocol/Feature.h>
8#include <xrpl/protocol/Indexes.h>
9#include <xrpl/protocol/Keylet.h>
10#include <xrpl/protocol/LedgerFormats.h>
11#include <xrpl/protocol/Rules.h>
12#include <xrpl/protocol/SField.h>
13#include <xrpl/protocol/STBase.h>
14#include <xrpl/protocol/STLedgerEntry.h>
15#include <xrpl/protocol/STObject.h>
16#include <xrpl/protocol/Serializer.h>
17#include <xrpl/protocol/jss.h>
19#include <boost/format/free_funcs.hpp>
32 :
STObject(sfLedgerEntry), key_(k.key), type_(k.type)
36 if (format ==
nullptr)
37 Throw<std::runtime_error>(
38 "Attempt to create a SLE of unknown type " +
41 set(format->getSOTemplate());
47 :
STObject(sfLedgerEntry), key_(index)
63 safe_cast<LedgerEntryType>(
getFieldU16(sfLedgerEntryType)));
65 if (format ==
nullptr)
66 Throw<std::runtime_error>(
"invalid ledger entry type");
68 type_ = format->getType();
77 if (format ==
nullptr)
78 Throw<std::runtime_error>(
"invalid ledger entry type");
83 ret += format->getName();
99 return emplace(n, buf, std::move(*
this));
105 return STI_LEDGERENTRY;
122 if (
getType() == ltMPTOKEN_ISSUANCE)
133 ltDIR_NODE, ltAMENDMENTS, ltFEE_SETTINGS, ltNEGATIVE_UNL, ltAMM};
136 bool const excludePrevTxnID = !rules.
enabled(fixPreviousTxnID) &&
138 newPreviousTxnIDTypes.
cbegin(),
139 newPreviousTxnIDTypes.
cend(),
141 return !excludePrevTxnID &&
getFieldIndex(sfPreviousTxnID) != -1;
153 JLOG(
debugLog().info()) <<
"Thread Tx:" << txID <<
" prev:" << oldPrevTxID;
155 if (oldPrevTxID == txID)
160 "ripple::STLedgerEntry::thread : ledger sequence match");
164 prevTxID = oldPrevTxID;
Rules controlling protocol behavior.
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
A type which can be exported to a well known binary format.
static STBase * emplace(std::size_t n, void *buf, T &&val)
STBase * move(std::size_t n, void *buf) override
STLedgerEntry(Keylet const &k)
Create an empty object with the given key and type.
LedgerEntryType getType() const
SerializedTypeID getSType() const override
std::string getFullText() const override
bool thread(uint256 const &txID, std::uint32_t ledgerSeq, uint256 &prevTxID, std::uint32_t &prevLedgerID)
Json::Value getJson(JsonOptions options=JsonOptions::none) const override
STBase * copy(std::size_t n, void *buf) const override
bool isThreadedType(Rules const &rules) const
std::string getText() const override
void applyTemplate(SOTemplate const &type)
AccountID getAccountID(SField const &field) const
std::uint16_t getFieldU16(SField const &field) const
void setFieldH256(SField const &field, uint256 const &)
std::uint32_t getFieldU32(SField const &field) const
void setFieldU16(SField const &field, std::uint16_t)
void set(SOTemplate const &)
int getFieldIndex(SField const &field) const
std::string getFullText() const override
std::string getText() const override
Json::Value getJson(JsonOptions=JsonOptions::none) const override
void setFieldU32(SField const &field, std::uint32_t)
uint256 getFieldH256(SField const &field) const
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
beast::Journal debugLog()
Returns a debug journal.
std::string to_string(base_uint< Bits, Tag > const &a)
MPTID makeMptID(std::uint32_t sequence, AccountID const &account)
Note, should be treated as flags that can be | and &.
A pair of SHAMap key and LedgerEntryType.