From 768aef30dca830925ab3a42aa20e64b1e3149382 Mon Sep 17 00:00:00 2001 From: Bart Date: Tue, 29 Sep 2026 12:30:58 +0000 Subject: [PATCH] fix: Count cluster messages as cluster traffic (#8308) --- src/test/overlay/traffic_count_test.cpp | 10 ++++++++++ src/xrpld/overlay/detail/TrafficCount.cpp | 1 + 2 files changed, 11 insertions(+) diff --git a/src/test/overlay/traffic_count_test.cpp b/src/test/overlay/traffic_count_test.cpp index a8a14ed111..83a0824b4c 100644 --- a/src/test/overlay/traffic_count_test.cpp +++ b/src/test/overlay/traffic_count_test.cpp @@ -25,6 +25,16 @@ public: auto const known = TrafficCount::categorize(message, protocol::mtPING, false); BEAST_EXPECT(known == TrafficCount::Category::Base); + // cluster messages have a category of their own, in both directions; the same lookup + // serves outbound traffic, so a missing entry would hide them from a node's report + // whichever way they traveled + BEAST_EXPECT( + TrafficCount::categorize(message, protocol::mtCLUSTER, true) == + TrafficCount::Category::Cluster); + BEAST_EXPECT( + TrafficCount::categorize(message, protocol::mtCLUSTER, false) == + TrafficCount::Category::Cluster); + // an unknown message type is categorized as unknown auto const unknown = TrafficCount::categorize(message, static_cast(99), false); diff --git a/src/xrpld/overlay/detail/TrafficCount.cpp b/src/xrpld/overlay/detail/TrafficCount.cpp index 90d5c0b4ff..81492db581 100644 --- a/src/xrpld/overlay/detail/TrafficCount.cpp +++ b/src/xrpld/overlay/detail/TrafficCount.cpp @@ -11,6 +11,7 @@ namespace xrpl { std::unordered_map const kTypeLookup = { {protocol::mtPING, TrafficCount::Category::Base}, {protocol::mtSTATUS_CHANGE, TrafficCount::Category::Base}, + {protocol::mtCLUSTER, TrafficCount::Category::Cluster}, {protocol::mtMANIFESTS, TrafficCount::Category::Manifests}, {protocol::mtENDPOINTS, TrafficCount::Category::Overlay}, {protocol::mtTRANSACTION, TrafficCount::Category::Transaction},