No test fails with this check, the one for blocks below and the one in ProcessMessages all removed, and none did before this PR either.
The test below fails without any one of the three.
<details>
<summary>Suggestion</summary>
diff --git a/src/test/net_tests.cpp b/src/test/net_tests.cpp
index 21ab8937ac..d114ed4e66 100644
--- a/src/test/net_tests.cpp
+++ b/src/test/net_tests.cpp
@@ -1822,4 +1822,37 @@ BOOST_AUTO_TEST_CASE(addlocal_onlynet_externalip)
fDiscover = discover_orig;
}
+BOOST_AUTO_TEST_CASE(paused_peer_backpressure)
+{
+ LOCK(NetEventsInterface::g_msgproc_mutex);
+ auto& connman{static_cast<ConnmanTestMsg&>(*m_node.connman)};
+ CNode peer{/*id=*/0, /*sock=*/nullptr, /*addrIn=*/CAddress{}, /*nKeyedNetGroupIn=*/0, /*nLocalHostNonceIn=*/0, /*addrBindIn=*/CService{}, /*addrNameIn=*/"", ConnectionType::INBOUND, /*inbound_onion=*/false, /*network_key=*/0};
+ connman.Handshake(peer, /*successfully_connected=*/true, ServiceFlags(NODE_NETWORK | NODE_WITNESS), ServiceFlags(NODE_NETWORK | NODE_WITNESS), PROTOCOL_VERSION, /*relay_txs=*/true);
+ std::vector<std::string> sent;
+ const auto capture_orig{CaptureMessage};
+ CaptureMessage = [&](const CAddress&, const std::string& type, std::span<const unsigned char>, bool incoming) { if (!incoming) sent.push_back(type); };
+ connman.SetCaptureMessages(true);
+
+ // Serving the first block fills the send buffer, so the rest of the request has to wait.
+ std::atomic<bool> interrupt{false};
+ const CInv block{MSG_WITNESS_BLOCK, Params().GenesisBlock().GetHash()};
+ for (const CInv& queued : {block, CInv{MSG_WTX, uint256::ONE}}) {
+ connman.FlushSendBuffer(peer);
+ BOOST_REQUIRE(connman.ReceiveMsgFrom(peer, NetMsg::Make(NetMsgType::GETDATA, std::vector{block, queued})));
+ connman.ProcessMessagesOnce(peer);
+ m_node.peerman->ProcessMessages(peer, interrupt);
+ BOOST_CHECK_EQUAL(sent.size(), 1U);
+ connman.ProcessMessagesOnce(peer);
+ sent.clear();
+ }
+
+ // Nor is a new message processed while the peer stays paused.
+ connman.FlushSendBuffer(peer);
+ BOOST_REQUIRE(connman.ReceiveMsgFrom(peer, NetMsg::Make(NetMsgType::PING, uint64_t{0})));
+ m_node.peerman->ProcessMessages(peer, interrupt);
+ BOOST_CHECK(sent.empty());
+ CaptureMessage = capture_orig;
+ m_node.peerman->FinalizeNode(peer);
+}
+
BOOST_AUTO_TEST_SUITE_END()
</details>