1#include <xrpld/app/ledger/TransactionMaster.h>
3#include <xrpld/app/main/Application.h>
4#include <xrpld/app/misc/Transaction.h>
6#include <xrpl/basics/RangeSet.h>
7#include <xrpl/basics/TaggedCache.ipp>
8#include <xrpl/basics/base_uint.h>
9#include <xrpl/basics/chrono.h>
10#include <xrpl/beast/utility/Zero.h>
11#include <xrpl/protocol/ErrorCodes.h>
12#include <xrpl/protocol/STTx.h>
13#include <xrpl/protocol/Serializer.h>
14#include <xrpl/protocol/TxMeta.h>
15#include <xrpl/protocol/TxSearched.h>
16#include <xrpl/shamap/SHAMapItem.h>
17#include <xrpl/shamap/SHAMapTreeNode.h>
19#include <boost/smart_ptr/intrusive_ptr.hpp>
35 std::chrono::minutes{30},
37 app_.getJournal(
"TaggedCache"))
48 auto txn =
cache_.fetch(hash);
60 return cache_.fetch(txnID);
69 return std::pair{std::move(txn),
nullptr};
76 auto [txn, txnMeta] = std::get<TxPair>(v);
79 cache_.canonicalizeReplaceClient(txnID, txn);
81 return std::pair{std::move(txn), std::move(txnMeta)};
93 return std::pair{std::move(txn),
nullptr};
100 auto [txn, txnMeta] = std::get<TxPair>(v);
103 cache_.canonicalizeReplaceClient(txnID, txn);
105 return std::pair{std::move(txn), std::move(txnMeta)};
110 boost::intrusive_ptr<SHAMapItem>
const& item,
132 if (uCommitLedger != 0u)
135 txn = iTx->getSTransaction();
144 uint256 const tid = (*pTransaction)->getID();
145 if (tid != beast::kZero)
147 auto txn = *pTransaction;
149 cache_.canonicalizeReplaceClient(tid, txn);
TaggedCache< uint256, Transaction > cache_
std::variant< std::pair< std::shared_ptr< Transaction >, std::shared_ptr< TxMeta > >, TxSearched > fetch(uint256 const &, ErrorCodeI &ec)
bool inLedger(uint256 const &hash, std::uint32_t ledger, std::optional< uint32_t > tseq, std::optional< uint32_t > netID)
TransactionMaster(Application &app)
void canonicalize(std::shared_ptr< Transaction > *pTransaction)
TaggedCache< uint256, Transaction > & getCache()
std::shared_ptr< Transaction > fetchFromCache(uint256 const &)
static std::variant< std::pair< std::shared_ptr< Transaction >, std::shared_ptr< TxMeta > >, TxSearched > load(uint256 const &id, Application &app, ErrorCodeI &ec)
T holds_alternative(T... args)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Stopwatch & stopwatch()
Returns an instance of a wall clock.
ClosedInterval< T > range(T low, T high)
Create a closed range interval.
boost::icl::closed_interval< T > ClosedInterval
A closed interval over the domain T.