xrpld
Loading...
Searching...
No Matches
AcceptedLedger.h
1#pragma once
2
3#include <xrpl/basics/CountedObject.h>
4#include <xrpl/core/ServiceRegistry.h>
5#include <xrpl/ledger/AcceptedLedgerTx.h>
6#include <xrpl/ledger/ReadView.h>
7
8#include <cstddef>
9#include <memory>
10#include <vector>
11
12namespace xrpl {
13
23/* VFALCO TODO digest this terminology clarification:
24 Closed and accepted refer to ledgers that have not passed the
25 validation threshold yet. Once they pass the threshold, they are
26 "Validated". Closed just means its close time has passed and no
27 new transactions can get in. "Accepted" means we believe it to be
28 the result of the a consensus process (though haven't validated
29 it yet).
30*/
31class AcceptedLedger : public CountedObject<AcceptedLedger>
32{
33public:
35
36 [[nodiscard]] std::shared_ptr<ReadView const> const&
37 getLedger() const
38 {
39 return ledger_;
40 }
41
42 [[nodiscard]] std::size_t
43 size() const
44 {
45 return transactions_.size();
46 }
47
48 [[nodiscard]] auto
49 begin() const
50 {
51 return transactions_.begin();
52 }
53
54 [[nodiscard]] auto
55 end() const
56 {
57 return transactions_.end();
58 }
59
63 [[nodiscard]] AcceptedLedgerTx const&
64 back() const
65 {
66 return *transactions_.back();
67 }
68
69private:
72};
73
74} // namespace xrpl
A transaction that is in a closed ledger.
std::vector< std::unique_ptr< AcceptedLedgerTx > > transactions_
std::shared_ptr< ReadView const > ledger_
AcceptedLedgerTx const & back() const
The last accepted transaction.
AcceptedLedger(std::shared_ptr< ReadView const > ledger)
std::shared_ptr< ReadView const > const & getLedger() const
std::size_t size() const
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5