1#ifndef XRPL_CONSENSUS_CONSENSUSPROPOSAL_H_INCLUDED
2#define XRPL_CONSENSUS_CONSENSUSPROPOSAL_H_INCLUDED
4#include <xrpl/basics/base_uint.h>
5#include <xrpl/basics/chrono.h>
6#include <xrpl/json/json_value.h>
7#include <xrpl/protocol/HashPrefix.h>
8#include <xrpl/protocol/digest.h>
9#include <xrpl/protocol/jss.h>
39template <
class NodeID_t,
class LedgerID_t,
class Position_t>
144 return time_ <= cutoff;
156 Position_t
const& newPosition,
209 ret[jss::close_time] =
255template <
class NodeID_t,
class LedgerID_t,
class Position_t>
Represents a proposed position taken during a round of consensus.
LedgerID_t const & prevLedger() const
Get the prior accepted ledger this position is based on.
std::optional< uint256 > signingHash_
The signing hash for this proposal.
NetClock::time_point const & seenTime() const
Get when this position was taken.
void bowOut(NetClock::time_point now)
Leave consensus.
Json::Value getJson() const
Get JSON representation for debugging.
void changePosition(Position_t const &newPosition, NetClock::time_point newCloseTime, NetClock::time_point now)
Update the position during the consensus process.
NetClock::time_point closeTime_
The ledger close time this position is taking.
NetClock::time_point time_
NetClock::time_point const & closeTime() const
The current position on the consensus close time.
bool isInitial() const
Whether this is the first position taken during the current consensus round.
static std::uint32_t const seqJoin
bool isBowOut() const
Get whether this node left the consensus process.
LedgerID_t previousLedger_
Unique identifier of prior ledger this proposal is based on.
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.
std::uint32_t proposeSeq_
The sequence number of these positions taken by this node.
static std::uint32_t const seqLeave
Position_t const & position() const
Get the proposed position.
std::string render() const
uint256 const & signingHash() const
The digest for this proposal, used for signing purposes.
NodeID_t nodeID_
The identifier of the node taking this position.
NodeID_t const & nodeID() const
Identifying which peer took this position.
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.
Position_t position_
Unique identifier of the position this proposal is taking.
@ objectValue
object value (collection of name/value pairs).
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
sha512_half_hasher::result_type sha512Half(Args const &... args)
Returns the SHA512-Half of a series of objects.
std::string to_string(base_uint< Bits, Tag > const &a)
constexpr bool operator==(base_uint< Bits, Tag > const &lhs, base_uint< Bits, Tag > const &rhs)
@ proposal
proposal for signing