PrevUpHomeNext

RCLValidations

Alias for RCL-specific instantiation of generic Validations.

Synopsis
using RCLValidations = Validations< RCLValidationsAdaptor >;

RCLValidations::RCLValidations

ripple::Validations

ripple__Validations

Member Functions

Name

Description

Validations

Constructor.

adaptor

Return the adaptor instance.

add

Add a new validation.

currentTrusted

Get the currently trusted full validations.

expire

Expire old validation sets.

fees

Returns fees reported by trusted full validators in the given ledger.

flush

Flush all current validations.

getCurrentPublicKeys

Get the set of known public keys associated with current validations.

getJsonTrie

getNodesAfter

Count the number of current trusted validators working on a ledger after the specified one.

getPreferred

Return the sequence number and ID of the preferred working ledger.

Get the ID of the preferred working ledger that exceeds a minimum valid ledger sequence number.

getPreferredLCL

Determine the preferred last closed ledger for the next consensus round.

getTrustedForLedger

Get trusted full validations for a specific ledger.

getTrustedValidationTimes

Return the sign times of all trusted full validations.

numTrustedForLedger

Count the number of trusted full validations for the given ledger.

parms

Return the validation timing parameters.

Manages storage and queries related to validations received on the network. Stores the most current validation from nodes and sets of recent validations grouped by ledger identifier.

Stored validations are not necessarily from trusted nodes, so clients and implementations should take care to use trusted member functions or check the validation's trusted status.

This class uses a generic interface to allow adapting Validations for specific applications. The Adaptor template implements a set of helper functions and type definitions. The code stubs below outline the interface and type requirements.

The Adaptor::MutexType is used to manage concurrent access to private members of Validations but does not manage any data in the Adaptor instance itself.

// Conforms to the Ledger type requirements of LedgerTrie
struct Ledger;

struct Validation
{
    using NodeKey = ...;

    // Ledger ID associated with this validation
    Ledger::ID ledgerID() const;

    // Sequence number of validation's ledger (0 means no sequence number)
    Ledger::Seq seq() const

    // When the validation was signed
    NetClock::time_point signTime() const;

    // When the validation was first observed by this node
    NetClock::time_point seenTime() const;

    // Signing key of node that published the validation
    NodeKey key() const;

    // Whether the publishing node was trusted at the time the validation
    // arrived
    bool trusted() const;

    // Whether this is a full or partial validation
    bool full() const;

    implementation_specific_t
    unwrap() -> return the implementation-specific type being wrapped

    // ... implementation specific
};

class Adaptor
{
    using Mutex = std::mutex;
    using Validation = Validation;
    using Ledger = Ledger;

    // Handle a newly stale validation, this should do minimal work since
    // it is called by Validations while it may be iterating Validations
    // under lock
    void onStale(Validation && );

    // Flush the remaining validations (typically done on shutdown)
    void flush(hash_map<NodeKey,Validation> && remaining);

    // Return the current network time (used to determine staleness)
    NetClock::time_point now() const;

    // Attempt to acquire a specific ledger.
    boost::optional<Ledger> acquire(Ledger::ID const & ledgerID);

    // ... implementation specific
};
Template Parameters

Type

Description

Adaptor

Provides type definitions and callbacks

Description
Header

#include <ripple/app/consensus/RCLValidations.h>


PrevUpHomeNext