1#ifndef XRPL_TEST_CSF_UNL_H_INCLUDED
2#define XRPL_TEST_CSF_UNL_H_INCLUDED
4#include <test/csf/random.h>
6#include <boost/container/flat_set.hpp>
121 for (
int i = 0; i < uniqueUNLs.
size(); ++i)
123 for (
int j = (i + 1); j < uniqueUNLs.
size(); ++j)
125 auto const& unlA = uniqueUNLs[i];
126 auto const& unlB = uniqueUNLs[j];
128 2.0 * (1. - quorum) *
std::max(unlA.size(), unlB.size());
130 int intersectionSize =
132 return unlB.find(p) != unlB.end();
135 if (intersectionSize < rhs)
138 ForkInfo{unlA, unlB, intersectionSize, rhs});
bool connected(Vertex source, Vertex target) const
Check if two vertices are connected.
auto outVertices() const
Range over vertices in the graph.
bool disconnect(Vertex source, Vertex target)
Disconnect two vertices.
bool connect(Vertex source, Vertex target, EdgeData e)
Connect two vertices.
void trust(Peer const &from, Peer const &to)
Create trust.
bool canFork(double quorum) const
Check whether this trust graph satisfies the whitepaper no-forking condition.
void untrust(Peer const &from, Peer const &to)
Remove trust.
std::vector< ForkInfo > forkablePairs(double quorum) const
auto trustedPeers(Peer const &a) const
Range over trusted peers.
bool trusts(Peer const &from, Peer const &to) const
TrustGraph()=default
Create an empty trust graph.
T emplace_back(T... args)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
A single peer in the simulation.
An example of nodes that fail the whitepaper no-forking condition.