xrpld
Loading...
Searching...
No Matches
include
xrpl
tx
invariants
LoanBrokerInvariant.h
1
#pragma once
2
3
#include <xrpl/basics/base_uint.h>
4
#include <xrpl/beast/utility/Journal.h>
5
#include <xrpl/ledger/ReadView.h>
6
#include <xrpl/protocol/STLedgerEntry.h>
7
#include <xrpl/protocol/STTx.h>
8
#include <xrpl/protocol/TER.h>
9
#include <xrpl/protocol/XRPAmount.h>
10
11
#include <
map
>
12
#include <
vector
>
13
14
namespace
xrpl
{
15
24
class
ValidLoanBroker
25
{
26
// Not all of these elements will necessarily be populated. Remaining items
27
// will be looked up as needed.
28
struct
BrokerInfo
29
{
30
SLE::const_pointer
brokerBefore
=
nullptr
;
31
// After is used for most of the checks, except
32
// those that check changed values.
33
SLE::const_pointer
brokerAfter
=
nullptr
;
34
};
35
// Collect all the LoanBrokers found directly or indirectly through
36
// pseudo-accounts. Key is the brokerID / index. It will be used to find the
37
// LoanBroker object if brokerBefore and brokerAfter are nullptr
38
std::map<uint256, BrokerInfo>
brokers_
;
39
// Collect all the modified trust lines. Their high and low accounts will be
40
// loaded to look for LoanBroker pseudo-accounts.
41
std::vector<SLE::const_pointer>
lines_
;
42
// Collect all the modified MPTokens. Their accounts will be loaded to look
43
// for LoanBroker pseudo-accounts.
44
std::vector<SLE::const_pointer>
mpts_
;
45
46
static
bool
47
goodZeroDirectory
(
ReadView
const
& view,
SLE::const_ref
dir,
beast::Journal
const
& j);
48
49
public
:
50
void
51
visitEntry
(
bool
,
SLE::const_ref
,
SLE::const_ref
);
52
53
bool
54
finalize
(
STTx
const
&,
TER
const
,
XRPAmount
const
,
ReadView
const
&,
beast::Journal
const
&);
55
};
56
57
}
// namespace xrpl
beast::Journal
A generic endpoint for log messages.
Definition
Journal.h:44
xrpl::ReadView
A view into a ledger.
Definition
ReadView.h:41
xrpl::STLedgerEntry::const_ref
std::shared_ptr< STLedgerEntry const > const & const_ref
Definition
STLedgerEntry.h:34
xrpl::STLedgerEntry::const_pointer
std::shared_ptr< STLedgerEntry const > const_pointer
Definition
STLedgerEntry.h:33
xrpl::STTx
Definition
STTx.h:41
xrpl::ValidLoanBroker
Invariants: Loan brokers are internally consistent.
Definition
LoanBrokerInvariant.h:25
xrpl::ValidLoanBroker::brokers_
std::map< uint256, BrokerInfo > brokers_
Definition
LoanBrokerInvariant.h:38
xrpl::ValidLoanBroker::goodZeroDirectory
static bool goodZeroDirectory(ReadView const &view, SLE::const_ref dir, beast::Journal const &j)
Definition
LoanBrokerInvariant.cpp:51
xrpl::ValidLoanBroker::visitEntry
void visitEntry(bool, SLE::const_ref, SLE::const_ref)
Definition
LoanBrokerInvariant.cpp:23
xrpl::ValidLoanBroker::mpts_
std::vector< SLE::const_pointer > mpts_
Definition
LoanBrokerInvariant.h:44
xrpl::ValidLoanBroker::lines_
std::vector< SLE::const_pointer > lines_
Definition
LoanBrokerInvariant.h:41
xrpl::ValidLoanBroker::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition
LoanBrokerInvariant.cpp:92
xrpl::XRPAmount
Definition
XRPAmount.h:28
map
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:5
xrpl::TER
TERSubset< CanCvtToTER > TER
Definition
TER.h:647
xrpl::ValidLoanBroker::BrokerInfo
Definition
LoanBrokerInvariant.h:29
xrpl::ValidLoanBroker::BrokerInfo::brokerBefore
SLE::const_pointer brokerBefore
Definition
LoanBrokerInvariant.h:30
xrpl::ValidLoanBroker::BrokerInfo::brokerAfter
SLE::const_pointer brokerAfter
Definition
LoanBrokerInvariant.h:33
vector
Generated by
1.16.1