From cb236ac6ee6c5960531c7d239592ff6e4c00a443 Mon Sep 17 00:00:00 2001 From: Vito Tumas <5780819+Tapanito@users.noreply.github.com> Date: Fri, 2 May 2025 17:01:45 +0200 Subject: [PATCH] Enable passive squelching (#5358) This change updates the squelching logic to accept squelch messages for untrusted validators. As a result, servers will also squelch untrusted validator messages reducing duplicate traffic they generate. In particular: * Updates squelch message handling logic to squelch messages for all validators, not only trusted ones. * Updates the logic to send squelch messages to peers that don't squelch themselves * Increases the threshold for the number of messages that a peer has to deliver to consider it as a candidate for validator messages. --- src/xrpld/overlay/ReduceRelayCommon.h | 4 ++-- src/xrpld/overlay/detail/PeerImp.cpp | 15 +-------------- src/xrpld/overlay/detail/PeerImp.h | 5 +---- 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/src/xrpld/overlay/ReduceRelayCommon.h b/src/xrpld/overlay/ReduceRelayCommon.h index 01d7dc597..473e5d152 100644 --- a/src/xrpld/overlay/ReduceRelayCommon.h +++ b/src/xrpld/overlay/ReduceRelayCommon.h @@ -45,8 +45,8 @@ static constexpr auto IDLED = std::chrono::seconds{8}; // of messages from the validator. We add peers who reach // MIN_MESSAGE_THRESHOLD to considered pool once MAX_SELECTED_PEERS // reach MAX_MESSAGE_THRESHOLD. -static constexpr uint16_t MIN_MESSAGE_THRESHOLD = 9; -static constexpr uint16_t MAX_MESSAGE_THRESHOLD = 10; +static constexpr uint16_t MIN_MESSAGE_THRESHOLD = 19; +static constexpr uint16_t MAX_MESSAGE_THRESHOLD = 20; // Max selected peers to choose as the source of messages from validator static constexpr uint16_t MAX_SELECTED_PEERS = 5; // Wait before reduce-relay feature is enabled on boot up to let diff --git a/src/xrpld/overlay/detail/PeerImp.cpp b/src/xrpld/overlay/detail/PeerImp.cpp index d69aa9b63..8084fb287 100644 --- a/src/xrpld/overlay/detail/PeerImp.cpp +++ b/src/xrpld/overlay/detail/PeerImp.cpp @@ -113,10 +113,7 @@ PeerImp::PeerImp( headers_, FEATURE_TXRR, app_.config().TX_REDUCE_RELAY_ENABLE)) - , vpReduceRelayEnabled_(peerFeatureEnabled( - headers_, - FEATURE_VPRR, - app_.config().VP_REDUCE_RELAY_ENABLE)) + , vpReduceRelayEnabled_(app_.config().VP_REDUCE_RELAY_ENABLE) , ledgerReplayEnabled_(peerFeatureEnabled( headers_, FEATURE_LEDGER_REPLAY, @@ -2715,16 +2712,6 @@ PeerImp::onMessage(std::shared_ptr const& m) } PublicKey key(slice); - // Ignore non-validator squelch - if (!app_.validators().listed(key)) - { - fee_.update(Resource::feeInvalidData, "squelch non-validator"); - JLOG(p_journal_.debug()) - << "onMessage: TMSquelch discarding non-validator squelch " - << slice; - return; - } - // Ignore the squelch for validator's own messages. if (key == app_.getValidationPublicKey()) { diff --git a/src/xrpld/overlay/detail/PeerImp.h b/src/xrpld/overlay/detail/PeerImp.h index 459b359ff..9835f4c6f 100644 --- a/src/xrpld/overlay/detail/PeerImp.h +++ b/src/xrpld/overlay/detail/PeerImp.h @@ -705,10 +705,7 @@ PeerImp::PeerImp( headers_, FEATURE_TXRR, app_.config().TX_REDUCE_RELAY_ENABLE)) - , vpReduceRelayEnabled_(peerFeatureEnabled( - headers_, - FEATURE_VPRR, - app_.config().VP_REDUCE_RELAY_ENABLE)) + , vpReduceRelayEnabled_(app_.config().VP_REDUCE_RELAY_ENABLE) , ledgerReplayEnabled_(peerFeatureEnabled( headers_, FEATURE_LEDGER_REPLAY,