xrpld
Loading...
Searching...
No Matches
LocalTxs.h
1#pragma once
2
3#include <xrpl/ledger/CanonicalTXSet.h>
4#include <xrpl/ledger/ReadView.h>
5#include <xrpl/protocol/Protocol.h>
6#include <xrpl/protocol/STTx.h>
7
8#include <cstddef>
9#include <memory>
10
11namespace xrpl {
12
13// Track transactions issued by local clients
14// Ensure we always apply them to our open ledger
15// Hold them until we see them in a fully-validated ledger
16
18{
19public:
20 // The number of ledgers to hold a transaction is essentially
21 // arbitrary. It should be sufficient to allow the transaction to
22 // get into a fully-validated ledger.
23 static constexpr int kHoldLedgers = 5;
24
25 virtual ~LocalTxs() = default;
26
27 // Add a new local transaction
28 virtual void
30
31 // Return the set of local transactions to a new open ledger
32 virtual CanonicalTXSet
33 getTxSet() = 0;
34
35 // Remove obsolete transactions based on a new fully-valid ledger
36 virtual void
37 sweep(ReadView const& view) = 0;
38
39 virtual std::size_t
40 size() = 0;
41};
42
45
46} // namespace xrpl
Holds transactions which were deferred to the next pass of consensus.
static constexpr int kHoldLedgers
Definition LocalTxs.h:23
virtual void pushBack(LedgerIndex index, std::shared_ptr< STTx const > const &txn)=0
virtual void sweep(ReadView const &view)=0
virtual ~LocalTxs()=default
virtual std::size_t size()=0
virtual CanonicalTXSet getTxSet()=0
A view into a ledger.
Definition ReadView.h:41
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
std::uint32_t LedgerIndex
A ledger index.
Definition Protocol.h:370
std::unique_ptr< LocalTxs > makeLocalTxs()
Definition LocalTxs.cpp:185