20#ifndef RIPPLE_CONSENSUS_CONSENSUSPROPOSAL_H_INCLUDED
21#define RIPPLE_CONSENSUS_CONSENSUSPROPOSAL_H_INCLUDED
23#include <xrpl/basics/base_uint.h>
24#include <xrpl/basics/chrono.h>
25#include <xrpl/json/json_value.h>
26#include <xrpl/protocol/HashPrefix.h>
27#include <xrpl/protocol/digest.h>
28#include <xrpl/protocol/jss.h>
58template <
class NodeID_t,
class LedgerID_t,
class Position_t>
163 return time_ <= cutoff;
175 Position_t
const& newPosition,
228 ret[jss::close_time] =
274template <
class NodeID_t,
class LedgerID_t,
class Position_t>
Represents a proposed position taken during a round of consensus.
void changePosition(Position_t const &newPosition, NetClock::time_point newCloseTime, NetClock::time_point now)
Update the position during the consensus process.
ConsensusProposal(LedgerID_t const &prevLedger, std::uint32_t seq, Position_t const &position, NetClock::time_point closeTime, NetClock::time_point now, NodeID_t const &nodeID)
Constructor.
LedgerID_t const & prevLedger() const
Get the prior accepted ledger this position is based on.
NetClock::time_point time_
bool isBowOut() const
Get whether this node left the consensus process.
uint256 const & signingHash() const
The digest for this proposal, used for signing purposes.
NetClock::time_point closeTime_
The ledger close time this position is taking.
NodeID_t const & nodeID() const
Identifying which peer took this position.
std::string render() const
std::uint32_t proposeSeq_
The sequence number of these positions taken by this node.
std::optional< uint256 > signingHash_
The signing hash for this proposal.
static std::uint32_t const seqJoin
NetClock::time_point const & closeTime() const
The current position on the consensus close time.
LedgerID_t previousLedger_
Unique identifier of prior ledger this proposal is based on.
Json::Value getJson() const
Get JSON representation for debugging.
void bowOut(NetClock::time_point now)
Leave consensus.
static std::uint32_t const seqLeave
NodeID_t nodeID_
The identifier of the node taking this position.
Position_t position_
Unique identifier of the position this proposal is taking.
Position_t const & position() const
Get the proposed position.
NetClock::time_point const & seenTime() const
Get when this position was taken.
bool isStale(NetClock::time_point cutoff) const
Get whether this position is stale relative to the provided cutoff.
std::uint32_t proposeSeq() const
Get the sequence number of this proposal.
bool isInitial() const
Whether this is the first position taken during the current consensus round.
@ objectValue
object value (collection of name/value pairs).
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::string to_string(base_uint< Bits, Tag > const &a)
@ proposal
proposal for signing
constexpr bool operator==(base_uint< Bits, Tag > const &lhs, base_uint< Bits, Tag > const &rhs)
sha512_half_hasher::result_type sha512Half(Args const &... args)
Returns the SHA512-Half of a series of objects.
Set the sequence number on a JTx.