From 92e72b5d0d49aa395e626c238bc28aba8e4c3d44 Mon Sep 17 00:00:00 2001 From: dergoegge Date: Wed, 29 Nov 2023 12:03:49 +0000 Subject: [PATCH] [net processing] Move IgnoresIncomingTxs to PeerManagerInfo --- src/net_processing.cpp | 2 +- src/net_processing.h | 4 +--- src/rpc/net.cpp | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 6289d139893..0a6f180ab4d 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -519,7 +519,6 @@ public: EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex); bool GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats) const override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex); PeerManagerInfo GetInfo() const override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex); - bool IgnoresIncomingTxs() override { return m_opts.ignore_incoming_txs; } void SendPings() override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex); void RelayTransaction(const uint256& txid, const uint256& wtxid) override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex); void SetBestBlock(int height, std::chrono::seconds time) override @@ -1809,6 +1808,7 @@ PeerManagerInfo PeerManagerImpl::GetInfo() const { return PeerManagerInfo{ .median_outbound_time_offset = m_outbound_time_offsets.Median(), + .ignores_incoming_txs = m_opts.ignore_incoming_txs, }; } diff --git a/src/net_processing.h b/src/net_processing.h index d0ff02311b8..85e399d948b 100644 --- a/src/net_processing.h +++ b/src/net_processing.h @@ -48,6 +48,7 @@ struct CNodeStateStats { struct PeerManagerInfo { std::chrono::seconds median_outbound_time_offset{0s}; + bool ignores_incoming_txs{false}; }; class PeerManager : public CValidationInterface, public NetEventsInterface @@ -93,9 +94,6 @@ public: /** Get peer manager info. */ virtual PeerManagerInfo GetInfo() const = 0; - /** Whether this node ignores txs received over p2p. */ - virtual bool IgnoresIncomingTxs() = 0; - /** Relay transaction to all peers. */ virtual void RelayTransaction(const uint256& txid, const uint256& wtxid) = 0; diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index 823b6d620fd..e3d50917a5b 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -679,7 +679,7 @@ static RPCHelpMan getnetworkinfo() } if (node.peerman) { auto peerman_info{node.peerman->GetInfo()}; - obj.pushKV("localrelay", !node.peerman->IgnoresIncomingTxs()); + obj.pushKV("localrelay", !peerman_info.ignores_incoming_txs); obj.pushKV("timeoffset", Ticks(peerman_info.median_outbound_time_offset)); } if (node.connman) {