From db84acfc5f99ac1ddf4962879b4cbaf1af9952dd Mon Sep 17 00:00:00 2001 From: bitflash Date: Tue, 18 Aug 2026 10:04:28 -0300 Subject: net: cap inbound connections per address A single IP could hold every inbound slot up to MAX_CONNECTIONS -- which is what a connection-exhaustion flood did to the rendezvous relays, one address parking hundreds of sockets and starving real peers. Add MAX_CONNECTIONS_PER_IP (32): the accept path counts existing connections from the same address and refuses a new one past the cap. The relays' firewall connlimit does the same a layer lower; this makes every build carry the defense, including future poll()-based relays with no FD ceiling. --- src/net.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/net.h') diff --git a/src/net.h b/src/net.h index 984588b..4fdd1b3 100644 --- a/src/net.h +++ b/src/net.h @@ -112,6 +112,15 @@ static const int BTF_INCOMPLETE_MESSAGE_TIMEOUT_SECS = 2 * 60; // 125 is Bitcoin's number and remains a conservative public-node default. static const unsigned int MAX_CONNECTIONS = 125; +// Cap inbound connections from any single address. Without it one source can +// hold every slot up to MAX_CONNECTIONS -- exactly what happened to the +// rendezvous relays, where a single IP parked hundreds of connections and +// starved real peers. A legitimate peer, even a relay talking to a relay, +// needs only a handful; 32 leaves generous room while denying any one address +// more than a quarter of the table. The firewall connlimit on the relays does +// the same thing a layer lower; this makes every build carry the defense. +static const unsigned int MAX_CONNECTIONS_PER_IP = 32; + // A node marked for disconnect is normally held until its buffers drain, so // a last message still goes out. But vSend cannot drain through a socket // whose far end is gone, and that made such a node immortal: it stayed in -- cgit v1.2.3 From 33092ffe8ee5fb5f7c080a44831e5557b63deb63 Mon Sep 17 00:00:00 2001 From: bitflash Date: Tue, 18 Aug 2026 10:24:01 -0300 Subject: net: exempt loopback from the per-IP connection cap Review follow-up. A managed-Tor node receives every inbound onion peer over its local hidden-service listener, so they all accept as 127.0.0.1. Capping loopback would cap onion peers as one group and refuse the 33rd legitimate onion peer -- the wrong limit for a network moving toward onion-only. Exempt loopback (127.0.0.0/8): the global MAX_CONNECTIONS still bounds the total, and the direct-IP flood this defends against never arrives over loopback. Bench: a 40-connection flood from 127.0.0.1 is now held in full (no per-IP refusal), while a flood from the machine's LAN address still caps at exactly 32. --- src/net.cpp | 22 +++++++++++++++++----- src/net.h | 8 ++++++++ 2 files changed, 25 insertions(+), 5 deletions(-) (limited to 'src/net.h') diff --git a/src/net.cpp b/src/net.cpp index 6e74cbb..4603d2d 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1627,11 +1627,23 @@ void ThreadSocketHandler2(void* parg) // node or a deliberate connection-exhaustion flood -- must not // be able to take the whole table, which is what starved the // relays. + // + // Loopback is exempt. Onion peers reach a managed-Tor node + // through its local hidden-service listener, so every one of + // them accepts as 127.0.0.1; capping loopback would cap all + // inbound onion peers as a single group, which is the opposite + // of where the network is headed. The global MAX_CONNECTIONS + // still bounds the total, and the direct-IP flood this defends + // against never arrives over loopback. (Per-onion-identity + // limiting, once a peer's identity is known past accept(), is + // the right tool for onion and is left for later.) + bool fLoopback = (addr.GetByte(3) == 127); unsigned int nFromThisIP = 0; - CRITICAL_BLOCK(cs_vNodes) - for (vector::iterator it = vNodes.begin(); it != vNodes.end(); ++it) - if ((*it)->addr.ip == addr.ip) - nFromThisIP++; + if (!fLoopback) + CRITICAL_BLOCK(cs_vNodes) + for (vector::iterator it = vNodes.begin(); it != vNodes.end(); ++it) + if ((*it)->addr.ip == addr.ip) + nFromThisIP++; if (nNodes >= MAX_CONNECTIONS) { @@ -1639,7 +1651,7 @@ void ThreadSocketHandler2(void* parg) addr.ToString().c_str(), nNodes); BtfCloseSocket(hSocket); } - else if (nFromThisIP >= MAX_CONNECTIONS_PER_IP) + else if (!fLoopback && nFromThisIP >= MAX_CONNECTIONS_PER_IP) { LogPrint("net", "refusing connection from %s, already %u from that address\n", addr.ToString().c_str(), nFromThisIP); diff --git a/src/net.h b/src/net.h index 4fdd1b3..e3d4a93 100644 --- a/src/net.h +++ b/src/net.h @@ -119,6 +119,14 @@ static const unsigned int MAX_CONNECTIONS = 125; // needs only a handful; 32 leaves generous room while denying any one address // more than a quarter of the table. The firewall connlimit on the relays does // the same thing a layer lower; this makes every build carry the defense. +// +// Loopback (127.0.0.0/8) is exempt in the accept path. A managed-Tor node +// receives every inbound onion peer over its local hidden-service listener, so +// they all appear as 127.0.0.1 -- capping loopback would cap onion peers as a +// group, which is exactly wrong for a network moving toward onion-only. The +// global MAX_CONNECTIONS still bounds the total; a per-onion-identity limit, +// applied once identity is known after accept(), is the right future tool for +// onion floods. static const unsigned int MAX_CONNECTIONS_PER_IP = 32; // A node marked for disconnect is normally held until its buffers drain, so -- cgit v1.2.3 From 2661de141e46dadfb2903bb12e72dc87c5a64375 Mon Sep 17 00:00:00 2001 From: bitflash-maintainer Date: Wed, 2 Sep 2026 05:31:22 +0000 Subject: log: demote the four lines that were 90% of debug.log behind /debugrelay A 13-hour production capture was ~71% "sending: tx", ~16% "Nostr: discovered .btf peer", ~5% "Relaying wtx", and ~43% of raw lines were CBlock/CTransaction dumps -- all already under -debug, which operators run permanently, so -debug was useless as a filter. The category mechanism gains a verbose tier: "relay" and "nostrdiscovery" are accepted only with the new /debugrelay flag (which implies /debug); everything else keeps its current gate. Demoted, with message text unchanged for anyone grepping it: net.h "sending: tx (N bytes)" (BeginMessage/EndMessage/ AbortMessage all pick the category from the command, so no orphaned "(N bytes)" fragments leak into a plain -debug log) main.cpp "Relaying wtx", "received block:" + CBlock::print, and the BitcoinMiner block dump nostr.cpp "Nostr: discovered .btf peer" -> "nostrdiscovery" Pool/worker/payout, [payout], BLOCK ORPHANED/ACCEPTED and share flow lines are untouched. Because LogPrint dedup keys on category, demoted lines also keep their burst collapse under /debugrelay. Closes #35 --- src/main.cpp | 6 +++--- src/main_gui.cpp | 12 ++++++++++++ src/net.h | 22 ++++++++++++++++++---- src/nostr.cpp | 2 +- src/util.cpp | 13 +++++++++++++ src/util.h | 4 ++++ 6 files changed, 51 insertions(+), 8 deletions(-) (limited to 'src/net.h') diff --git a/src/main.cpp b/src/main.cpp index 7b3e555..80f5f31 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1712,7 +1712,7 @@ void CWalletTx::RelayWalletTransaction(CTxDB& txdb) uint256 hash = GetHash(); if (!txdb.ContainsTx(hash)) { - if (LogAcceptsCategory("net")) printf("Relaying wtx %s\n", hash.ToString().substr(0,6).c_str()); + if (LogAcceptsCategory("relay")) printf("Relaying wtx %s\n", hash.ToString().substr(0,6).c_str()); RelayMessage(CInv(MSG_TX, hash), (CTransaction)*this); } } @@ -3263,7 +3263,7 @@ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) vRecv >> *pblock; //// debug print - if (LogAcceptsCategory("net")) { printf("received block:\n"); pblock->print(); } + if (LogAcceptsCategory("relay")) { printf("received block:\n"); pblock->print(); } CInv inv(MSG_BLOCK, pblock->GetHash()); pfrom->AddInventoryKnown(inv); @@ -4555,7 +4555,7 @@ bool BitcoinMiner(int nThreadId) //// debug print if (LogAcceptsCategory("net")) printf("BitcoinMiner:\n"); if (LogAcceptsCategory("net")) printf("RandomX proof-of-work found \n powhash: %s \ntarget: %s\n", hash.GetHex().c_str(), hashTarget.GetHex().c_str()); - if (LogAcceptsCategory("net")) pblock->print(); + if (LogAcceptsCategory("relay")) pblock->print(); SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL); CRITICAL_BLOCK(cs_main) diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 05f5ecf..163d78e 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -111,6 +111,7 @@ static void PrintUsage() printf(" /help, -help, --help, /?\n"); printf(" /datadir=PATH\n"); printf(" /debug\n"); + printf(" /debugrelay (/debug plus per-message relay chatter and block dumps)\n"); printf(" /maxdebugfilesize=N (roll debug.log at N MB, default 1024; 0 = never)\n"); printf(" /gen\n"); printf(" /nogui or /daemon\n"); @@ -192,6 +193,17 @@ static void ParseStartupArguments(int argc, char* argv[]) if (arg(argc,argv,"/debug") || arg(argc,argv,"-debug")) fDebug = true; + // /debugrelay -- everything /debug shows, plus the per-message firehose + // ("relay" and "nostrdiscovery" categories: sending: tx, Relaying wtx, + // raw CBlock dumps, per-peer discovery lines). That traffic was ~90% of + // a 13-hour production debug.log (issue #35), so plain /debug leaves it + // off; the message text itself is unchanged for anyone grepping it. + if (arg(argc,argv,"/debugrelay") || arg(argc,argv,"-debugrelay")) + { + fDebug = true; + fDebugRelay = true; + } + // /maxdebugfilesize=N -- roll debug.log to debug.log.old once it passes // N MB, checked on each write. Default is 1024 (see util.cpp); 0 turns // the check off and leaves rotation entirely to logrotate. diff --git a/src/net.h b/src/net.h index 9f3c7e4..1aee973 100644 --- a/src/net.h +++ b/src/net.h @@ -802,6 +802,18 @@ public: + // "sending: tx (N bytes)" alone was ~71% of a 13-hour production + // debug.log (issue #35), so tx sends are demoted to the /debugrelay-gated + // "relay" category; every other command's send trace stays on "net". + // The line is emitted in pieces across BeginMessage/EndMessage/ + // AbortMessage, so all three must agree on the category or orphaned + // "(N bytes)" fragments would leak into a plain -debug log. + // Valid only mid-message (nPushPos != -1). + const char* SendLogCategory() const + { + return strcmp(GetMessageCommand(), "tx") == 0 ? "relay" : "net"; + } + void BeginMessage(const char* pszCommand) { EnterCriticalSection(&cs_vSend); @@ -809,17 +821,19 @@ public: AbortMessage(); nPushPos = vSend.size(); vSend << CMessageHeader(pszCommand, 0); - if (LogAcceptsCategory("net")) printf("sending: %-12s ", pszCommand); + if (LogAcceptsCategory(SendLogCategory())) printf("sending: %-12s ", pszCommand); } void AbortMessage() { if (nPushPos == -1) return; + // Capture before nPushPos is cleared; GetMessageCommand() needs it. + const char* pszCategory = SendLogCategory(); vSend.resize(nPushPos); nPushPos = -1; LeaveCriticalSection(&cs_vSend); - if (LogAcceptsCategory("net")) printf("(aborted)\n"); + if (LogAcceptsCategory(pszCategory)) printf("(aborted)\n"); } void EndMessage() @@ -839,10 +853,10 @@ public: unsigned int nSize = vSend.size() - nPushPos - sizeof(CMessageHeader); memcpy((char*)&vSend[nPushPos] + offsetof(CMessageHeader, nMessageSize), &nSize, sizeof(nSize)); - if (LogAcceptsCategory("net")) printf("(%d bytes) ", nSize); + if (LogAcceptsCategory(SendLogCategory())) printf("(%d bytes) ", nSize); //for (int i = nPushPos+sizeof(CMessageHeader); i < min(vSend.size(), nPushPos+sizeof(CMessageHeader)+20U); i++) // printf("%02x ", vSend[i] & 0xff); - if (LogAcceptsCategory("net")) printf("\n"); + if (LogAcceptsCategory(SendLogCategory())) printf("\n"); nPushPos = -1; LeaveCriticalSection(&cs_vSend); diff --git a/src/nostr.cpp b/src/nostr.cpp index e2d839c..9bbf74e 100644 --- a/src/nostr.cpp +++ b/src/nostr.cpp @@ -1440,7 +1440,7 @@ static bool SeedFromRelay(CNostrKey& key, const string& relay) else if (createdAt > it->second) it->second = createdAt; // refresh } if (fNew && fDebug) - LogPrint("nostr", "Nostr: discovered .btf peer %s\n", peerAddr.c_str()); + LogPrint("nostrdiscovery", "Nostr: discovered .btf peer %s\n", peerAddr.c_str()); if (++nPeers > 500) break; } else if (type == "EOSE") diff --git a/src/util.cpp b/src/util.cpp index 52cda84..a5a4e80 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -7,6 +7,7 @@ bool fDebug = false; +bool fDebugRelay = false; // In-process cap for debug.log, in bytes. Default matches the 1G trigger of // the shipped logrotate policy so a long-running node stays bounded even @@ -31,10 +32,22 @@ static bool LogCategoryDefaultOn(const char* category) strcmp(category, "payout") == 0; } +// Categories so noisy they drown out everything else even under -debug: +// per-message send traces, wallet relay rebroadcasts, raw CBlock dumps and +// per-address discovery lines made up ~90% of a 13-hour production capture +// (issue #35). They need /debugrelay, not merely /debug. +static bool LogCategoryVerboseOnly(const char* category) +{ + return strcmp(category, "relay") == 0 || + strcmp(category, "nostrdiscovery") == 0; +} + bool LogAcceptsCategory(const char* category) { if (LogCategoryDefaultOn(category)) return true; + if (LogCategoryVerboseOnly(category)) + return fDebugRelay; return fDebug; } diff --git a/src/util.h b/src/util.h index f2ea23f..c47b8a7 100644 --- a/src/util.h +++ b/src/util.h @@ -87,6 +87,10 @@ inline T& REF(const T& val) extern bool fDebug; +// /debugrelay: the per-message firehose ("relay" and "nostrdiscovery" +// categories) that even -debug keeps off. See LogAcceptsCategory(). +extern bool fDebugRelay; + // debug.log is rolled to debug.log.old once it grows past this many bytes // (set from -maxdebugfilesize, in MB; 0 disables the check). See the roll // site in OutputDebugStringF() below. -- cgit v1.2.3 From 73e77c3bc259a4c8e0a4cc5c376f1a9545439bdd Mon Sep 17 00:00:00 2001 From: bitflash-maintainer Date: Wed, 2 Sep 2026 08:29:44 +0000 Subject: net: retry block fetches every 15s, not every two minutes AskFor keys its retry spacing off mapAlreadyAskedFor, which is global to the inv, so the two-minute gap does more than pace re-requests to one peer: it strings the getdatas for one block across its announcers two minutes apart. When the first peer asked does not serve the body, the second candidate is not asked for 120s and the ninth for 960s -- the observed 16-minute tip stall of #33, during which the pool kept broadcasting jobs against the stale tip and 5 of 12 found blocks orphaned. A block body is at most 1 MB and somebody demonstrably has it -- they announced it -- so on this timescale "not here yet" means "not coming from that peer". Blocks now retry on BLOCK_FETCH_RETRY_SECS (15s); transactions keep the two-minute pacing, which for them is the point. --- src/net.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/net.h') diff --git a/src/net.h b/src/net.h index 9f3c7e4..2e4d8cb 100644 --- a/src/net.h +++ b/src/net.h @@ -89,6 +89,15 @@ static const int BTF_RECV_TIMEOUT_SECS = 30 * 60; static const int BTF_SEND_STALL_SECS = 10 * 60; static const int BTF_HANDSHAKE_GRACE_SECS = 60; +// How long a requested block gets before it is asked for again, in seconds. +// Used twice: CNode::AskFor spaces the queued per-announcer block retries this +// far apart instead of the two minutes transactions get, and the failover +// sweep in main.cpp re-issues a getdata to a different peer once a sent +// request has gone unanswered this long. A block body is at most 1 MB and +// somebody demonstrably has it -- they announced it -- so on this timescale +// "not here yet" means "not coming from that peer", not "still in transit". +static const int BLOCK_FETCH_RETRY_SECS = 15; + // A serialized object cannot be larger than MAX_SIZE, so no valid network // message needs the old 256 MB header allowance. Keep the wire cap aligned with // what the deserializer can accept. How long a peer may sit on a partial @@ -795,8 +804,16 @@ public: static int64 nLastTime; nLastTime = nNow = max(nNow, ++nLastTime); - // Each retry is 2 minutes after the last - nRequestTime = max(nRequestTime + 2 * 60 * 1000000, nNow); + // Each retry is 2 minutes after the last -- and because nRequestTime + // is shared across peers, the same spacing is what strings requests + // for one inv across its announcers. For transactions that is pacing; + // for a new block it was the stall of issue #33: nine peers announce + // the block, the first one asked does not serve it, and the ninth + // candidate is not even asked until sixteen minutes in, with the pool + // mining on the stale tip the whole time. Blocks retry on the fetch + // timescale instead. + int64 nRetryUsecs = (inv.type == MSG_BLOCK ? BLOCK_FETCH_RETRY_SECS : 2 * 60) * 1000000LL; + nRequestTime = max(nRequestTime + nRetryUsecs, nNow); mapAskFor.insert(make_pair(nRequestTime, inv)); } -- cgit v1.2.3 From cd6edfc2c234db71d9b68f96702ad08a56cc3127 Mon Sep 17 00:00:00 2001 From: bitflash-maintainer Date: Wed, 2 Sep 2026 16:10:24 +0000 Subject: net: only use the 15s block retry spacing at the tip nRequestTime lives in mapAlreadyAskedFor, which is global to the inv, so the spacing AskFor applies is not per-peer pacing: it is what strings the getdatas for one block across its announcers. Shortening it to 15s was right at the tip and wrong everywhere else, and the eight-entry cap that made the failover table safe for catch-up does not cover this at all -- it is a different mechanism. At two minutes a second announcer's queued request almost always fired after the block had arrived, so AlreadyHave dropped it. At fifteen seconds, with a peer working through a 500-deep queue and block N legitimately minutes away, the second announcer is asked at +15s, the third at +30s, and the bulk download arrives once per announcer -- up to eight times over, with nothing bounding it. So the fast spacing is now conditional on tracking the tip, measured off the age of our own best block. Not off a peer-reported height: nStartingHeight is optional in the version message and every node released so far sends the short form, so it is -1 for essentially every peer, and where it does get filled in later it comes from the height of a block that peer served us, which during catch-up tracks our own height and would answer "at the tip" for the entire download. Block timestamps are the one clock a peer cannot move, being bounded above by CheckBlock and below by AcceptBlock's median-time rule. Thirty block intervals is the threshold: far longer than any stall worth failing over from, far shorter than catching up. Failover at the tip does not rest on this in any case -- mapBlockFetch re-issues a stalled getdata to the next peer on its own 15s timer, and that is what actually answers #33. --- src/main.cpp | 23 +++++++++++++++++++++++ src/net.h | 30 +++++++++++++++++++++++++++--- 2 files changed, 50 insertions(+), 3 deletions(-) (limited to 'src/net.h') diff --git a/src/main.cpp b/src/main.cpp index 9ab1f44..be89416 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -101,6 +101,29 @@ static const int BLOCK_FETCH_TRACK_MAX = 8; // forever; a re-announcement recreates it. static const int BLOCK_FETCH_GIVEUP_SECS = 10 * 60; +// How stale our own best block may be before we stop calling this the tip. +// Blocks target two minutes, so this is thirty intervals: far longer than any +// stall worth failing over from -- the one in #33 ran sixteen minutes -- and +// far shorter than catching up, which starts hours or days back. +static const int BLOCK_FETCH_TIP_AGE_SECS = 60 * 60; + +// Whether this node is tracking the tip rather than still catching up. +// +// Measured off the age of our own best block, not off any height a peer told +// us. nStartingHeight is optional in the version message and every node +// released so far sends the short form, so it is -1 for essentially every +// peer; and where it is filled in later it is filled in from the height of a +// block that peer served us, which during catch-up tracks our own height and +// would report "at the tip" for the whole download. Block timestamps are the +// one clock here that peers cannot move: CheckBlock refuses anything more than +// two hours ahead and AcceptBlock refuses anything at or before the previous +// median, so the only way to make this read "at the tip" falsely is to mine, +// and all that buys is the 15s spacing this code had unconditionally anyway. +bool IsBlockFetchNearTip() +{ + return pindexBest && (int64)pindexBest->nTime > GetTime() - BLOCK_FETCH_TIP_AGE_SECS; +} + // Drop one entry so a hash announced by addrNew can be tracked. // // Refusing the insertion instead was a remote off-switch for the whole diff --git a/src/net.h b/src/net.h index 2e4d8cb..64f061f 100644 --- a/src/net.h +++ b/src/net.h @@ -23,6 +23,12 @@ enum +// Defined in main.cpp. True while this node is tracking the tip rather than +// still catching up, measured off the age of our own best block -- see there +// for why that and not a peer-reported height. Declared here because net.h is +// parsed before main.h and CNode::AskFor needs it. +bool IsBlockFetchNearTip(); + bool GetMyExternalIP(unsigned int& ipRet); CNode* ConnectNodeBtf(const string& strBtfAddr); CNode* ConnectNodeBtfResolved(const string& strBtfAddr, const string& strMeeting, @@ -810,9 +816,27 @@ public: // for a new block it was the stall of issue #33: nine peers announce // the block, the first one asked does not serve it, and the ninth // candidate is not even asked until sixteen minutes in, with the pool - // mining on the stale tip the whole time. Blocks retry on the fetch - // timescale instead. - int64 nRetryUsecs = (inv.type == MSG_BLOCK ? BLOCK_FETCH_RETRY_SECS : 2 * 60) * 1000000LL; + // mining on the stale tip the whole time. + // + // Blocks retry on the fetch timescale, but only while we are at the + // tip. That is where the stall costs something -- the pool keeps + // handing out jobs against a dead tip -- and it is also where the + // spacing is nearly free: one block is in flight, and its body has + // almost always arrived before the second announcer's turn comes + // round, so AlreadyHave drops the duplicate before a getdata is sent. + // + // While catching up neither half holds. A peer working through a + // 500-deep queue can be minutes away from block N without anything + // being wrong, so at 15s the second announcer is asked at +15s, the + // third at +30s, and the bulk download arrives once per announcer -- + // up to eight times over. Nothing caps that: the eight-entry cap is on + // mapBlockFetch, which is a different mechanism from this spacing. + // Two minutes is the right number there, and it is what this line did + // before. Failover at the tip does not depend on this being 15s in any + // case: mapBlockFetch re-issues a stalled getdata to the next peer on + // its own timer, which is what actually fixes #33. + bool fFast = (inv.type == MSG_BLOCK && IsBlockFetchNearTip()); + int64 nRetryUsecs = (fFast ? BLOCK_FETCH_RETRY_SECS : 2 * 60) * 1000000LL; nRequestTime = max(nRequestTime + nRetryUsecs, nNow); mapAskFor.insert(make_pair(nRequestTime, inv)); } -- cgit v1.2.3 From cc21a1db50c14c0c41986e9137432e5ba8918b2d Mon Sep 17 00:00:00 2001 From: bitflash-maintainer Date: Wed, 2 Sep 2026 16:44:57 +0000 Subject: net: gate the dropped-send line on the category of the send it drops 2661de1 said all the "sending: " emission sites agree on the category. There is a fourth, and it did not: EndMessage()'s -dropmessagestest path hardcoded "net", so under plain -debug a dropped tx announced its own drop while the "sending: tx" it interrupts was gated off under "relay". The knob is test-only, so nothing operational rode on it, but the claim was false as written. Derive it from SendLogCategory() like the other three. nPushPos may be -1 at this point, and GetMessageCommand() returns "" there, so the category is "net" exactly as before when there is no message in progress. --- src/net.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/net.h') diff --git a/src/net.h b/src/net.h index 1aee973..600922a 100644 --- a/src/net.h +++ b/src/net.h @@ -841,7 +841,11 @@ public: extern int nDropMessagesTest; if (nDropMessagesTest > 0 && GetRand(nDropMessagesTest) == 0) { - if (LogAcceptsCategory("net")) printf("dropmessages DROPPING SEND MESSAGE\n"); + // Same category as the "sending: " this line interrupts, so a tx + // does not announce its own drop under "net" having been gated + // off under "relay". nPushPos can be -1 here, and then + // GetMessageCommand() returns "" and this is "net" as before. + if (LogAcceptsCategory(SendLogCategory())) printf("dropmessages DROPPING SEND MESSAGE\n"); AbortMessage(); return; } -- cgit v1.2.3