xrpld
Loading...
Searching...
No Matches
xrpl::test::csf::TrustGraph< Peer > Class Template Reference

Trust graph. More...

#include <TrustGraph.h>

Collaboration diagram for xrpl::test::csf::TrustGraph< Peer >:

Classes

struct  ForkInfo
 An example of nodes that fail the whitepaper no-forking condition. More...

Public Member Functions

 TrustGraph ()=default
 Create an empty trust graph.
Graph const & graph ()
void trust (Peer const &from, Peer const &to)
 Create trust.
void untrust (Peer const &from, Peer const &to)
 Remove trust.
bool trusts (Peer const &from, Peer const &to) const
auto trustedPeers (Peer const &a) const
 Range over trusted peers.
std::vector< ForkInfoforkablePairs (double quorum) const
bool canFork (double quorum) const
 Check whether this trust graph satisfies the whitepaper no-forking condition.

Private Types

using Graph = Digraph<Peer>

Private Attributes

Graph graph_

Detailed Description

template<class Peer>
class xrpl::test::csf::TrustGraph< Peer >

Trust graph.

Trust is a directed relationship from a node i to node j. If node i trusts node j, then node i has node j in its UNL. This class wraps a digraph representing the trust relationships for all peers in the simulation.

Definition at line 23 of file TrustGraph.h.

Member Typedef Documentation

◆ Graph

template<class Peer>
using xrpl::test::csf::TrustGraph< Peer >::Graph = Digraph<Peer>
private

Definition at line 25 of file TrustGraph.h.

Constructor & Destructor Documentation

◆ TrustGraph()

template<class Peer>
xrpl::test::csf::TrustGraph< Peer >::TrustGraph ( )
default

Create an empty trust graph.

Member Function Documentation

◆ graph()

template<class Peer>
Graph const & xrpl::test::csf::TrustGraph< Peer >::graph ( )

Definition at line 35 of file TrustGraph.h.

◆ trust()

template<class Peer>
void xrpl::test::csf::TrustGraph< Peer >::trust ( Peer const & from,
Peer const & to )

Create trust.

Establish trust between Peer from and Peer to; as if from put to in its UNL.

Parameters
fromThe peer granting trust
toThe peer receiving trust

Definition at line 50 of file TrustGraph.h.

◆ untrust()

template<class Peer>
void xrpl::test::csf::TrustGraph< Peer >::untrust ( Peer const & from,
Peer const & to )

Remove trust.

Revoke trust from Peer from to Peer to; as if from removed to from its UNL.

Parameters
fromThe peer revoking trust
toThe peer being revoked

Definition at line 64 of file TrustGraph.h.

◆ trusts()

template<class Peer>
bool xrpl::test::csf::TrustGraph< Peer >::trusts ( Peer const & from,
Peer const & to ) const
nodiscard

Definition at line 71 of file TrustGraph.h.

◆ trustedPeers()

template<class Peer>
auto xrpl::test::csf::TrustGraph< Peer >::trustedPeers ( Peer const & a) const
nodiscard

Range over trusted peers.

Parameters
aThe node granting trust
Returns
boost transformed range over nodes a trusts, i.e. the nodes in its UNL

Definition at line 83 of file TrustGraph.h.

◆ forkablePairs()

template<class Peer>
std::vector< ForkInfo > xrpl::test::csf::TrustGraph< Peer >::forkablePairs ( double quorum) const
nodiscard

Definition at line 100 of file TrustGraph.h.

◆ canFork()

template<class Peer>
bool xrpl::test::csf::TrustGraph< Peer >::canFork ( double quorum) const
nodiscard

Check whether this trust graph satisfies the whitepaper no-forking condition.

Definition at line 142 of file TrustGraph.h.

Member Data Documentation

◆ graph_

template<class Peer>
Graph xrpl::test::csf::TrustGraph< Peer >::graph_
private

Definition at line 27 of file TrustGraph.h.