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/STTx.h>
7
#include <xrpl/protocol/TER.h>
8
9
#include <
map
>
10
#include <
vector
>
11
12
namespace
xrpl
{
13
22
class
ValidLoanBroker
23
{
24
// Not all of these elements will necessarily be populated. Remaining items
25
// will be looked up as needed.
26
struct
BrokerInfo
27
{
28
SLE::const_pointer
brokerBefore
=
nullptr
;
29
// After is used for most of the checks, except
30
// those that check changed values.
31
SLE::const_pointer
brokerAfter
=
nullptr
;
32
};
33
// Collect all the LoanBrokers found directly or indirectly through
34
// pseudo-accounts. Key is the brokerID / index. It will be used to find the
35
// LoanBroker object if brokerBefore and brokerAfter are nullptr
36
std::map<uint256, BrokerInfo>
brokers_
;
37
// Collect all the modified trust lines. Their high and low accounts will be
38
// loaded to look for LoanBroker pseudo-accounts.
39
std::vector<SLE::const_pointer>
lines_
;
40
// Collect all the modified MPTokens. Their accounts will be loaded to look
41
// for LoanBroker pseudo-accounts.
42
std::vector<SLE::const_pointer>
mpts_
;
43
44
static
bool
45
goodZeroDirectory
(
ReadView
const
& view,
SLE::const_ref
dir,
beast::Journal
const
& j);
46
47
public
:
48
void
49
visitEntry
(
bool
,
SLE::const_ref
,
SLE::const_ref
);
50
51
bool
52
finalize
(
STTx
const
&,
TER
const
,
XRPAmount
const
,
ReadView
const
&,
beast::Journal
const
&);
53
};
54
55
}
// namespace xrpl
beast::Journal
A generic endpoint for log messages.
Definition
Journal.h:38
xrpl::ReadView
A view into a ledger.
Definition
ReadView.h:31
xrpl::STLedgerEntry::const_ref
std::shared_ptr< STLedgerEntry const > const & const_ref
Definition
STLedgerEntry.h:22
xrpl::STLedgerEntry::const_pointer
std::shared_ptr< STLedgerEntry const > const_pointer
Definition
STLedgerEntry.h:21
xrpl::STTx
Definition
STTx.h:28
xrpl::ValidLoanBroker
Invariants: Loan brokers are internally consistent.
Definition
LoanBrokerInvariant.h:23
xrpl::ValidLoanBroker::brokers_
std::map< uint256, BrokerInfo > brokers_
Definition
LoanBrokerInvariant.h:36
xrpl::ValidLoanBroker::goodZeroDirectory
static bool goodZeroDirectory(ReadView const &view, SLE::const_ref dir, beast::Journal const &j)
Definition
LoanBrokerInvariant.cpp:49
xrpl::ValidLoanBroker::visitEntry
void visitEntry(bool, SLE::const_ref, SLE::const_ref)
Definition
LoanBrokerInvariant.cpp:21
xrpl::ValidLoanBroker::mpts_
std::vector< SLE::const_pointer > mpts_
Definition
LoanBrokerInvariant.h:42
xrpl::ValidLoanBroker::lines_
std::vector< SLE::const_pointer > lines_
Definition
LoanBrokerInvariant.h:39
xrpl::ValidLoanBroker::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition
LoanBrokerInvariant.cpp:90
xrpl::XRPAmount
Definition
XRPAmount.h:23
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:634
xrpl::ValidLoanBroker::BrokerInfo
Definition
LoanBrokerInvariant.h:27
xrpl::ValidLoanBroker::BrokerInfo::brokerBefore
SLE::const_pointer brokerBefore
Definition
LoanBrokerInvariant.h:28
xrpl::ValidLoanBroker::BrokerInfo::brokerAfter
SLE::const_pointer brokerAfter
Definition
LoanBrokerInvariant.h:31
vector
Generated by
1.16.1