20 #ifndef RIPPLE_APP_MISC_NEGATIVEUNLVOTE_H_INCLUDED
21 #define RIPPLE_APP_MISC_NEGATIVEUNLVOTE_H_INCLUDED
23 #include <ripple/app/ledger/Ledger.h>
24 #include <ripple/beast/utility/Journal.h>
25 #include <ripple/protocol/Protocol.h>
26 #include <ripple/protocol/PublicKey.h>
27 #include <ripple/protocol/UintTypes.h>
33 template <
class Adaptor>
35 class RCLValidationsAdaptor;
39 class NegativeUNLVoteInternal_test;
40 class NegativeUNLVoteScoreTable_test;
Validations< RCLValidationsAdaptor > RCLValidations
Alias for RCL-specific instantiation of generic Validations.
void doVoting(std::shared_ptr< Ledger const > const &prevLedger, hash_set< PublicKey > const &unlKeys, RCLValidations &validations, std::shared_ptr< SHAMap > const &initialSet)
Cast our local vote on the NegativeUNL candidates.
~NegativeUNLVote()=default
constexpr std::uint32_t FLAG_LEDGER_INTERVAL
static constexpr size_t negativeUNLHighWaterMark
An unreliable validator must have more than negativeUNLHighWaterMark validations in the last flag led...
hash_map< NodeID, LedgerIndex > newValidators_
std::vector< NodeID > toDisableCandidates
std::vector< NodeID > toReEnableCandidates
const Candidates findAllCandidates(hash_set< NodeID > const &unl, hash_set< NodeID > const &negUnl, hash_map< NodeID, std::uint32_t > const &scoreTable)
Process the score table and find all disabling and re-enabling candidates.
static constexpr float negativeUNLMaxListed
We only want to put 25% of the UNL on the NegativeUNL.
static constexpr size_t negativeUNLMinLocalValsToVote
The minimum number of validations of the local node for it to participate in the voting.
A generic endpoint for log messages.
std::optional< hash_map< NodeID, std::uint32_t > > buildScoreTable(std::shared_ptr< Ledger const > const &prevLedger, hash_set< NodeID > const &unl, RCLValidations &validations)
Build a reliability measurement score table of validators' validation messages in the last flag ledge...
void addTx(LedgerIndex seq, PublicKey const &vp, NegativeUNLModify modify, std::shared_ptr< SHAMap > const &initialSet)
Add a ttUNL_MODIFY Tx to the transaction set.
static constexpr size_t newValidatorDisableSkip
We don't want to disable new validators immediately after adding them.
Rest the build score table function of NegativeUNLVote.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
NegativeUNLModify
A flag indicating whether a UNLModify Tx is to disable or to re-enable a validator.
static constexpr size_t negativeUNLLowWaterMark
A validator is considered unreliable if its validations is less than negativeUNLLowWaterMark in the l...
Test the private member functions of NegativeUNLVote.
void purgeNewValidators(LedgerIndex seq)
Purge validators that are not new anymore.
Manager to create NegativeUNL votes.
NodeID choose(uint256 const &randomPadData, std::vector< NodeID > const &candidates)
Pick one candidate from a vector of candidates.
NegativeUNLVote(NodeID const &myId, beast::Journal j)
Constructor.
void newValidators(LedgerIndex seq, hash_set< NodeID > const &nowTrusted)
Notify NegativeUNLVote that new validators are added.