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.
bool txExists(uint256 const &key) const override
std::unique_ptr< txs_type::iter_base > txsEnd() const override
bool isFlagLedger() const
Returns true if the ledger is a flag ledger.
std::optional< digest_type > digest(key_type const &key) const override
Return the digest associated with the key.
void rawTxInsert(uint256 const &key, std::shared_ptr< Serializer const > const &txn, std::shared_ptr< Serializer const > const &metaData) override
std::optional< PublicKey > validatorToDisable() const
get the to be disabled validator's master public key if any
void setLedgerInfo(LedgerHeader const &info)
uint256 rawTxInsertWithHash(uint256 const &key, std::shared_ptr< Serializer const > const &txn, std::shared_ptr< Serializer const > const &metaData)
std::shared_ptr< SLE const > read(Keylet const &k) const override
Return the state item associated with a key.
void setValidated() const
void updateNegativeUNL()
update the Negative UNL ledger component.
bool assertSensible(beast::Journal ledgerJ) const
bool isVotingLedger() const
Returns true if the ledger directly precedes a flag ledger.
std::unique_ptr< sles_type::iter_base > slesBegin() const override
hash_set< PublicKey > negativeUNL() const
get Negative UNL validators' master public keys
void rawInsert(std::shared_ptr< SLE > const &sle) override
Unconditionally insert a state item.
void rawReplace(std::shared_ptr< SLE > const &sle) override
Unconditionally replace a state item.
void setImmutable(bool rehash=true)
SHAMap const & stateMap() const
SHAMap const & txMap() const
void defaultFees(Config const &config)
bool open() const override
Returns true if this reflects an open ledger.
void rawErase(std::shared_ptr< SLE > const &sle) override
Delete an existing state item.
LedgerHeader const & header() const override
Returns information about the ledger.
void setAccepted(NetClock::time_point closeTime, NetClock::duration closeResolution, bool correctCloseTime)
Ledger(Ledger const &)=delete
Ledger & operator=(Ledger const &)=delete
std::shared_ptr< SLE > peek(Keylet const &k) const
void setTotalDrops(std::uint64_t totDrops)
bool addSLE(SLE const &sle)
void rawDestroyXRP(XRPAmount const &fee) override
Destroy XRP.
std::unique_ptr< txs_type::iter_base > txsBegin() const override
std::unique_ptr< sles_type::iter_base > slesEnd() const override
std::optional< uint256 > succ(uint256 const &key, std::optional< uint256 > const &last=std::nullopt) const override
Ledger & operator=(Ledger &&)=delete
Rules const & rules() const override
Returns the tx processing rules.
Fees const & fees() const override
Returns the fees for the base ledger.
bool walkLedger(beast::Journal j, bool parallel=false) const
std::unique_ptr< sles_type::iter_base > slesUpperBound(uint256 const &key) const override
std::optional< PublicKey > validatorToReEnable() const
get the to be re-enabled validator's master public key if any
tx_type txRead(key_type const &key) const override
Read a transaction from the tx map.
bool exists(Keylet const &k) const override
Determine if a state item exists.
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::shared_ptr< Ledger > loadByHash(uint256 const &ledgerHash, Application &app, bool acquire)
std::shared_ptr< Ledger > loadLedgerHelper(LedgerHeader const &info, Application &app, bool acquire)
bool isCurrent(ValidationParms const &p, NetClock::time_point now, NetClock::time_point signTime, NetClock::time_point seenTime)
Whether a validation is still current.
bool isFlagLedger(LedgerIndex seq)
Returns true if the given ledgerIndex is a flag ledgerIndex.
std::pair< std::shared_ptr< STTx const >, std::shared_ptr< STObject const > > deserializeTxPlusMeta(SHAMapItem const &item)
Deserialize a SHAMapItem containing STTx + STObject metadata.
std::tuple< std::shared_ptr< Ledger >, std::uint32_t, uint256 > getLatestLedger(Application &app)
std::shared_ptr< STTx const > deserializeTx(SHAMapItem const &item)
Deserialize a SHAMapItem containing a single STTx.
create_genesis_t const create_genesis
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.
uint256 calculateLedgerHash(LedgerHeader const &info)
std::shared_ptr< Ledger > loadByIndex(std::uint32_t ledgerIndex, Application &app, bool acquire)
std::uint32_t constexpr FLAG_LEDGER_INTERVAL
Reflects the fee settings for a particular ledger.
A pair of SHAMap key and LedgerEntryType.
create_genesis_t()=default