xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
include
xrpl
tx
invariants
InvariantRunner.h
1
#pragma once
2
3
#include <xrpl/beast/utility/Journal.h>
4
#include <xrpl/ledger/ReadView.h>
5
#include <xrpl/protocol/STLedgerEntry.h>
6
#include <xrpl/protocol/STTx.h>
7
#include <xrpl/protocol/TER.h>
8
#include <xrpl/protocol/XRPAmount.h>
9
#include <xrpl/tx/ApplyContext.h>
10
11
#include <
functional
>
12
#include <
optional
>
13
14
namespace
xrpl
{
15
61
class
TxInvariantCheck
62
{
63
public
:
64
virtual
~TxInvariantCheck
() =
default
;
65
77
virtual
void
78
visitEntry
(
bool
isDelete,
SLE::ConstRef
before,
SLE::ConstRef
after
) = 0;
79
91
[[nodiscard]]
virtual
bool
92
finalize
(
93
STTx
const
& tx,
94
TER
result,
95
XRPAmount
fee,
96
ReadView
const
& view,
97
beast::Journal
const
& j) = 0;
98
};
99
127
[[nodiscard]]
TER
128
checkInvariants
(
129
ApplyContext
& ctx,
130
TER
result,
131
XRPAmount
fee,
132
std::optional
<
std::reference_wrapper<TxInvariantCheck>
> txCheck);
133
134
[[nodiscard]]
inline
TER
135
checkInvariants
(
ApplyContext
& ctx,
TER
result,
XRPAmount
fee)
136
{
137
return
checkInvariants
(ctx, result, fee, std::nullopt);
138
}
139
140
}
// namespace xrpl
beast::Journal
A generic endpoint for log messages.
Definition
Journal.h:44
xrpl::ApplyContext
State information when applying a tx.
Definition
ApplyContext.h:28
xrpl::ReadView
A view into a ledger.
Definition
ReadView.h:41
xrpl::STLedgerEntry::ConstRef
std::shared_ptr< STLedgerEntry const > const & ConstRef
Definition
STLedgerEntry.h:37
xrpl::STTx
Definition
STTx.h:43
xrpl::TxInvariantCheck
Runtime interface for a transaction-specific invariant check.
Definition
InvariantRunner.h:62
xrpl::TxInvariantCheck::finalize
virtual bool finalize(STTx const &tx, TER result, XRPAmount fee, ReadView const &view, beast::Journal const &j)=0
Called after all entries have been visited.
xrpl::TxInvariantCheck::~TxInvariantCheck
virtual ~TxInvariantCheck()=default
xrpl::TxInvariantCheck::visitEntry
virtual void visitEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after)=0
Called for each ledger entry modified by the transaction.
xrpl::XRPAmount
Definition
XRPAmount.h:28
functional
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:5
xrpl::checkInvariants
TER checkInvariants(ApplyContext &ctx, TER result, XRPAmount fee, std::optional< std::reference_wrapper< TxInvariantCheck > > txCheck)
Run all protocol invariant checks plus the transaction-specific check in a single pass over the modif...
Definition
InvariantRunner.cpp:96
xrpl::after
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition
View.cpp:644
xrpl::TER
TERSubset< CanCvtToTER > TER
Definition
TER.h:654
optional
std::reference_wrapper
Generated by
1.17.0