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