clean up imports, and typos

This commit is contained in:
Vito
2025-07-31 11:42:13 +02:00
parent 395c64bb52
commit 5b8dd45261
6 changed files with 28 additions and 26 deletions

View File

@@ -33,7 +33,6 @@
#include <functional>
#include <optional>
#include <sstream>
#include <string>
namespace ripple {
@@ -200,16 +199,7 @@ private:
std::string
formatLogMessage(PublicKey const& validator, std::optional<Peer::id_t> id)
const
{
std::stringstream ss;
ss << "validator: " << toBase58(TokenType::NodePublic, validator);
if (id)
ss << " peer: " << *id;
ss << " trusted: " << isTrusted_;
ss << " slot_state: " << to_string(getState());
return ss.str();
}
const;
/**
* @brief Processes a message from a peer and updates the slot's state.

View File

@@ -20,8 +20,6 @@
#ifndef RIPPLE_OVERLAY_SQUELCH_H_INCLUDED
#define RIPPLE_OVERLAY_SQUELCH_H_INCLUDED
#include <xrpld/overlay/Peer.h>
#include <xrpl/basics/Log.h>
#include <xrpl/beast/utility/Journal.h>
#include <xrpl/protocol/PublicKey.h>

View File

@@ -29,7 +29,6 @@
#include <xrpld/app/misc/ValidatorList.h>
#include <xrpld/app/tx/apply.h>
#include <xrpld/overlay/Cluster.h>
#include <xrpld/overlay/Peer.h>
#include <xrpld/overlay/ReduceRelayCommon.h>
#include <xrpld/overlay/detail/PeerImp.h>
#include <xrpld/overlay/detail/Tuning.h>
@@ -2396,14 +2395,16 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMValidation> const& m)
TrafficCount::category::validation_untrusted,
Message::messageSize(*m));
overlay_.updateUntrustedValidatorSlot(
key, val->getSignerPublic(), id_);
// If the operator has specified that untrusted validations be
// dropped then this happens here I.e. before further wasting CPU
// verifying the signature of an untrusted key
// TODO: Deprecate RELAY_UNTRUSTED_VALIDATIONS config once enhanced
// squelching is the defacto routing algorithm.
if (app_.config().RELAY_UNTRUSTED_VALIDATIONS == -1)
return;
overlay_.updateUntrustedValidatorSlot(
key, val->getSignerPublic(), id_);
}
if (!isTrusted && (tracking_.load() == Tracking::diverged))

View File

@@ -23,6 +23,7 @@
#include <xrpld/app/consensus/RCLCxPeerPos.h>
#include <xrpld/app/ledger/detail/LedgerReplayMsgHandler.h>
#include <xrpld/app/misc/HashRouter.h>
#include <xrpld/overlay/Peer.h>
#include <xrpld/overlay/SquelchStore.h>
#include <xrpld/overlay/detail/OverlayImpl.h>
#include <xrpld/overlay/detail/ProtocolVersion.h>

View File

@@ -34,6 +34,7 @@
#include <cstddef>
#include <optional>
#include <sstream>
#include <string>
namespace ripple {
namespace reduce_relay {
@@ -309,6 +310,19 @@ Slot::initCounting()
}
}
std::string
Slot::formatLogMessage(PublicKey const& validator, std::optional<Peer::id_t> id)
const
{
std::stringstream ss;
ss << "validator: " << toBase58(TokenType::NodePublic, validator);
if (id)
ss << " peer: " << *id;
ss << " trusted: " << isTrusted_;
ss << " slot_state: " << to_string(getState());
return ss.str();
}
// --------------------------------- Slots --------------------------------- //
bool
@@ -377,7 +391,7 @@ Slots::updateSlotAndSquelch(
uint256 const& key,
PublicKey const& validator,
Peer::id_t id,
typename Slot::ignored_squelch_callback callback,
typename Slot::ignored_squelch_callback report,
bool isTrusted)
{
if (expireAndIsPeerMessageCached(key, id))
@@ -401,7 +415,7 @@ Slots::updateSlotAndSquelch(
clock_)))
.first;
it->second.update(validator, id, callback);
it->second.update(validator, id, report);
}
else
{
@@ -412,7 +426,7 @@ Slots::updateSlotAndSquelch(
if (it == untrustedSlots_.end())
return;
it->second.update(validator, id, callback);
it->second.update(validator, id, report);
}
}
@@ -421,21 +435,21 @@ Slots::updateUntrustedValidatorSlot(
uint256 const& key,
PublicKey const& validator,
Peer::id_t id,
typename Slot::ignored_squelch_callback callback)
typename Slot::ignored_squelch_callback report)
{
// We received a message from an already selected validator
// we can ignore this message
if (untrustedSlots_.find(validator) != untrustedSlots_.end())
return;
// We received a message from an already squelched validator.
// Did we receive a message from an already squelched validator?
// This could happen in few cases:
// 1. It happened so that the squelch for a particular peer expired
// before our local squelch.
// 2. We receive a message from a new peer that did not receive the
// squelch request.
// 3. The peer is ignoring our squelch request and we have not sent
// the controll message in a while.
// the control message in a while.
// In all of these cases we can only send them a squelch request again.
if (expireAndIsValidatorSquelched(validator))
{

View File

@@ -17,7 +17,6 @@
*/
//==============================================================================
#include <xrpld/overlay/Peer.h>
#include <xrpld/overlay/ReduceRelayCommon.h>
#include <xrpld/overlay/SquelchStore.h>
@@ -27,7 +26,6 @@
#include <chrono>
#include <unordered_map>
#include <vector>
namespace ripple {
@@ -45,7 +43,7 @@ SquelchStore::handleSquelch(
if (squelch)
{
// This should never trigger. The squelh duration is validated in
// This should never trigger. The squelch duration is validated in
// PeerImp.onMessage(TMSquelch). However, if somehow invalid duration is
// passed, log is as an error
if ((duration < reduce_relay::MIN_UNSQUELCH_EXPIRE ||