1#include <xrpld/app/ledger/TransactionMaster.h>
2#include <xrpld/app/main/Application.h>
3#include <xrpld/app/misc/Transaction.h>
5#include <xrpl/basics/TaggedCache.ipp>
6#include <xrpl/basics/chrono.h>
7#include <xrpl/protocol/STTx.h>
12 : mApp(app), mCache(
"TransactionCache", 65536,
std::chrono::minutes{30},
stopwatch(), mApp.journal(
"TaggedCache"))
23 auto txn =
mCache.fetch(hash);
28 txn->setStatus(
COMMITTED, ledger, tseq, netID);
35 return mCache.fetch(txnID);
44 return std::pair{std::move(txn),
nullptr};
54 mCache.canonicalize_replace_client(txnID, txn);
56 return std::pair{std::move(txn), std::move(txnMeta)};
65 return std::pair{std::move(txn),
nullptr};
75 mCache.canonicalize_replace_client(txnID, txn);
77 return std::pair{std::move(txn), std::move(txnMeta)};
102 iTx->setStatus(
COMMITTED, uCommitLedger);
104 txn = iTx->getSTransaction();
113 uint256 const tid = (*pTransaction)->getID();
114 if (tid != beast::zero)
116 auto txn = *pTransaction;
118 mCache.canonicalize_replace_client(tid, txn);
std::shared_ptr< Transaction > fetch_from_cache(uint256 const &)
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)
std::variant< std::pair< std::shared_ptr< Transaction >, std::shared_ptr< TxMeta > >, TxSearched > fetch(uint256 const &, error_code_i &ec)
TaggedCache< uint256, Transaction > & getCache()
TaggedCache< uint256, Transaction > mCache
static std::variant< std::pair< std::shared_ptr< Transaction >, std::shared_ptr< TxMeta > >, TxSearched > load(uint256 const &id, Application &app, error_code_i &ec)
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.