Skip to content

Commit f3f61d0

Browse files
committed
[net processing] Add IgnoresIncomingTxs() function to PeerManager
1 parent 5805b82 commit f3f61d0

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/net_processing.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ class PeerManager final : public CValidationInterface, public NetEventsInterface
138138
/** Get statistics from node state */
139139
bool GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats);
140140

141+
/** Whether this node ignores txs received over p2p. */
142+
bool IgnoresIncomingTxs() {return !::g_relay_txes;};
143+
141144
private:
142145
/** Get a shared pointer to the Peer object.
143146
* May return an empty shared_ptr if the Peer object can't be found. */

src/rpc/net.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,9 @@ static RPCHelpMan getnetworkinfo()
578578
obj.pushKV("localservices", strprintf("%016x", services));
579579
obj.pushKV("localservicesnames", GetServicesNames(services));
580580
}
581-
obj.pushKV("localrelay", g_relay_txes);
581+
if (node.peerman) {
582+
obj.pushKV("localrelay", !node.peerman->IgnoresIncomingTxs());
583+
}
582584
obj.pushKV("timeoffset", GetTimeOffset());
583585
if (node.connman) {
584586
obj.pushKV("networkactive", node.connman->GetNetworkActive());

0 commit comments

Comments
 (0)