From f3f61d0eb937ada5fd00d7d590f5f29325f7f414 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Thu, 22 Oct 2020 10:38:10 +0100 Subject: [PATCH] [net processing] Add IgnoresIncomingTxs() function to PeerManager --- src/net_processing.h | 3 +++ src/rpc/net.cpp | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/net_processing.h b/src/net_processing.h index 1dedcf3b980..cb34935ad18 100644 --- a/src/net_processing.h +++ b/src/net_processing.h @@ -138,6 +138,9 @@ public: /** Get statistics from node state */ bool GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats); + /** Whether this node ignores txs received over p2p. */ + bool IgnoresIncomingTxs() {return !::g_relay_txes;}; + private: /** Get a shared pointer to the Peer object. * May return an empty shared_ptr if the Peer object can't be found. */ diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index fa71ea11816..19e717f0af6 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -578,7 +578,9 @@ static RPCHelpMan getnetworkinfo() obj.pushKV("localservices", strprintf("%016x", services)); obj.pushKV("localservicesnames", GetServicesNames(services)); } - obj.pushKV("localrelay", g_relay_txes); + if (node.peerman) { + obj.pushKV("localrelay", !node.peerman->IgnoresIncomingTxs()); + } obj.pushKV("timeoffset", GetTimeOffset()); if (node.connman) { obj.pushKV("networkactive", node.connman->GetNetworkActive());