Skip to content

Commit fa1dce7

Browse files
author
MarcoFalke
committed
net: Rename ::fRelayTxes to ::g_relay_txes
This helps to distinguish it from CNode::fRelayTxes and avoid bugs like 425278d
1 parent c459c5f commit fa1dce7

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1426,7 +1426,7 @@ bool AppInitMain(InitInterfaces& interfaces)
14261426
// see Step 2: parameter interactions for more information about these
14271427
fListen = gArgs.GetBoolArg("-listen", DEFAULT_LISTEN);
14281428
fDiscover = gArgs.GetBoolArg("-discover", true);
1429-
fRelayTxes = !gArgs.GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY);
1429+
g_relay_txes = !gArgs.GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY);
14301430

14311431
for (const std::string& strAddr : gArgs.GetArgs("-externalip")) {
14321432
CService addrLocal;

src/net.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ static const uint64_t RANDOMIZER_ID_LOCALHOSTNONCE = 0xd93e69e2bbfa5735ULL; // S
7979
//
8080
bool fDiscover = true;
8181
bool fListen = true;
82-
bool fRelayTxes = true;
82+
bool g_relay_txes = !DEFAULT_BLOCKSONLY;
8383
CCriticalSection cs_mapLocalHost;
8484
std::map<CNetAddr, LocalServiceInfo> mapLocalHost GUARDED_BY(cs_mapLocalHost);
8585
static bool vfLimited[NET_MAX] GUARDED_BY(cs_mapLocalHost) = {};

src/net.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ CAddress GetLocalAddress(const CNetAddr *paddrPeer, ServiceFlags nLocalServices)
519519

520520
extern bool fDiscover;
521521
extern bool fListen;
522-
extern bool fRelayTxes;
522+
extern bool g_relay_txes;
523523

524524
/** Subversion as sent to the P2P network in `version` messages */
525525
extern std::string strSubVersion;

src/net_processing.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ static void PushNodeVersion(CNode *pnode, CConnman* connman, int64_t nTime)
422422
CAddress addrMe = CAddress(CService(), nLocalNodeServices);
423423

424424
connman->PushMessage(pnode, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::VERSION, PROTOCOL_VERSION, (uint64_t)nLocalNodeServices, nTime, addrYou, addrMe,
425-
nonce, strSubVersion, nNodeStartingHeight, ::fRelayTxes));
425+
nonce, strSubVersion, nNodeStartingHeight, ::g_relay_txes));
426426

427427
if (fLogIPs) {
428428
LogPrint(BCLog::NET, "send version message: version %d, blocks=%d, us=%s, them=%s, peer=%d\n", PROTOCOL_VERSION, nNodeStartingHeight, addrMe.ToString(), addrYou.ToString(), nodeid);
@@ -2189,7 +2189,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
21892189
return false;
21902190
}
21912191

2192-
bool fBlocksOnly = !fRelayTxes;
2192+
bool fBlocksOnly = !g_relay_txes;
21932193

21942194
// Allow whitelisted peers to send data other than blocks in blocks only mode if whitelistrelay is true
21952195
if (pfrom->fWhitelisted && gArgs.GetBoolArg("-whitelistrelay", DEFAULT_WHITELISTRELAY))
@@ -2445,7 +2445,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
24452445
if (strCommand == NetMsgType::TX) {
24462446
// Stop processing the transaction early if
24472447
// We are in blocks only mode and peer is either not whitelisted or whitelistrelay is off
2448-
if (!fRelayTxes && (!pfrom->fWhitelisted || !gArgs.GetBoolArg("-whitelistrelay", DEFAULT_WHITELISTRELAY)))
2448+
if (!g_relay_txes && (!pfrom->fWhitelisted || !gArgs.GetBoolArg("-whitelistrelay", DEFAULT_WHITELISTRELAY)))
24492449
{
24502450
LogPrint(BCLog::NET, "transaction sent in violation of protocol peer=%d\n", pfrom->GetId());
24512451
return true;

src/rpc/net.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ static UniValue getnetworkinfo(const JSONRPCRequest& request)
496496
obj.pushKV("protocolversion",PROTOCOL_VERSION);
497497
if(g_connman)
498498
obj.pushKV("localservices", strprintf("%016x", g_connman->GetLocalServices()));
499-
obj.pushKV("localrelay", fRelayTxes);
499+
obj.pushKV("localrelay", g_relay_txes);
500500
obj.pushKV("timeoffset", GetTimeOffset());
501501
if (g_connman) {
502502
obj.pushKV("networkactive", g_connman->GetNetworkActive());

0 commit comments

Comments
 (0)