1#ifndef XRPL_APP_LEDGER_LEDGER_H_INCLUDED
2#define XRPL_APP_LEDGER_LEDGER_H_INCLUDED
4#include <xrpld/core/Config.h>
5#include <xrpld/core/TimeKeeper.h>
7#include <xrpl/basics/CountedObject.h>
8#include <xrpl/beast/utility/Journal.h>
9#include <xrpl/ledger/CachedView.h>
10#include <xrpl/ledger/View.h>
11#include <xrpl/protocol/Indexes.h>
12#include <xrpl/protocol/STLedgerEntry.h>
13#include <xrpl/protocol/Serializer.h>
14#include <xrpl/protocol/TxMeta.h>
15#include <xrpl/shamap/SHAMap.h>
21class TransactionMaster;
254 bool correctCloseTime);
378 class sles_iter_impl;
A generic endpoint for log messages.
Wraps a DigestAwareReadView to provide caching.
Tracks the number of instances of an object.
ReadView that associates keys with digests.
LedgerInfo const & info() const override
Returns information about the ledger.
void setAccepted(NetClock::time_point closeTime, NetClock::duration closeResolution, bool correctCloseTime)
void defaultFees(Config const &config)
void rawTxInsert(uint256 const &key, std::shared_ptr< Serializer const > const &txn, std::shared_ptr< Serializer const > const &metaData) override
std::unique_ptr< sles_type::iter_base > slesUpperBound(uint256 const &key) const override
void rawDestroyXRP(XRPAmount const &fee) override
Destroy XRP.
bool open() const override
Returns true if this reflects an open ledger.
bool assertSensible(beast::Journal ledgerJ) const
bool exists(Keylet const &k) const override
Determine if a state item exists.
void rawReplace(std::shared_ptr< SLE > const &sle) override
Unconditionally replace a state item.
std::unique_ptr< sles_type::iter_base > slesEnd() const override
Ledger & operator=(Ledger const &)=delete
void rawErase(std::shared_ptr< SLE > const &sle) override
Delete an existing state item.
std::optional< PublicKey > validatorToReEnable() const
get the to be re-enabled validator's master public key if any
bool isFlagLedger() const
Returns true if the ledger is a flag ledger.
hash_set< PublicKey > negativeUNL() const
get Negative UNL validators' master public keys
SHAMap const & stateMap() const
bool txExists(uint256 const &key) const override
Ledger & operator=(Ledger &&)=delete
void setValidated() const
std::optional< PublicKey > validatorToDisable() const
get the to be disabled validator's master public key if any
bool isVotingLedger() const
Returns true if the ledger directly precedes a flag ledger.
void updateNegativeUNL()
update the Negative UNL ledger component.
std::shared_ptr< SLE > peek(Keylet const &k) const
std::optional< digest_type > digest(key_type const &key) const override
Return the digest associated with the key.
Fees const & fees() const override
Returns the fees for the base ledger.
tx_type txRead(key_type const &key) const override
Read a transaction from the tx map.
void setLedgerInfo(LedgerInfo const &info)
void rawInsert(std::shared_ptr< SLE > const &sle) override
Unconditionally insert a state item.
bool walkLedger(beast::Journal j, bool parallel=false) const
std::shared_ptr< SLE const > read(Keylet const &k) const override
Return the state item associated with a key.
Rules const & rules() const override
Returns the tx processing rules.
uint256 rawTxInsertWithHash(uint256 const &key, std::shared_ptr< Serializer const > const &txn, std::shared_ptr< Serializer const > const &metaData)
std::unique_ptr< sles_type::iter_base > slesBegin() const override
SHAMap const & txMap() const
void setTotalDrops(std::uint64_t totDrops)
std::unique_ptr< txs_type::iter_base > txsEnd() const override
std::unique_ptr< txs_type::iter_base > txsBegin() const override
std::optional< uint256 > succ(uint256 const &key, std::optional< uint256 > const &last=std::nullopt) const override
bool addSLE(SLE const &sle)
Ledger(Ledger const &)=delete
void setImmutable(bool rehash=true)
std::pair< std::shared_ptr< STTx const >, std::shared_ptr< STObject const > > tx_type
Rules controlling protocol behavior.
A SHAMap is both a radix tree with a fan-out of 16 and a Merkle tree.
void setLedgerSeq(std::uint32_t lseq)
Interface for changing ledger entries with transactions.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::tuple< std::shared_ptr< Ledger >, std::uint32_t, uint256 > getLatestLedger(Application &app)
std::pair< std::shared_ptr< STTx const >, std::shared_ptr< STObject const > > deserializeTxPlusMeta(SHAMapItem const &item)
Deserialize a SHAMapItem containing STTx + STObject metadata.
std::shared_ptr< Ledger > loadByIndex(std::uint32_t ledgerIndex, Application &app, bool acquire)
std::shared_ptr< STTx const > deserializeTx(SHAMapItem const &item)
Deserialize a SHAMapItem containing a single STTx.
bool isCurrent(ValidationParms const &p, NetClock::time_point now, NetClock::time_point signTime, NetClock::time_point seenTime)
Whether a validation is still current.
std::shared_ptr< Ledger > loadLedgerHelper(LedgerInfo const &info, Application &app, bool acquire)
uint256 calculateLedgerHash(LedgerInfo const &info)
std::shared_ptr< Ledger > loadByHash(uint256 const &ledgerHash, Application &app, bool acquire)
bool isFlagLedger(LedgerIndex seq)
Returns true if the given ledgerIndex is a flag ledgerIndex.
create_genesis_t const create_genesis
std::uint32_t constexpr FLAG_LEDGER_INTERVAL
bool pendSaveValidated(Application &app, std::shared_ptr< Ledger const > const &ledger, bool isSynchronous, bool isCurrent)
Save, or arrange to save, a fully-validated ledger Returns false on error.
Reflects the fee settings for a particular ledger.
A pair of SHAMap key and LedgerEntryType.
create_genesis_t()=default