From c32857c05b9fc88d59dd95ec4b4f4b10ac4f8890 Mon Sep 17 00:00:00 2001 From: fanquake Date: Thu, 24 Dec 2020 09:18:07 +0800 Subject: [PATCH] Merge #20747: net processing: Remove dropmessagestest 176325a5a47befe32d480b3dc206dd0e64e04b21 [net processing] Remove dropmessagestest (John Newbery) Pull request description: -dropmessagestest is a command line option that causes 1 in n received messages to be dropped. The Bitcoin P2P protocol is stateful and in general cannot handle messages being dropped. Dropped version/verack/ping/pong messages will cause the connection to time out and be torn down. Other dropped messages may also cause the peer to believe that the peer has stalled and tear down the connection. It seems difficult to uncover any actual issues with -dropmessagestest, and any coverage that could be generated would probably be easier to trigger with fuzz testing. ACKs for top commit: MarcoFalke: cr ACK 176325a5a47befe32d480b3dc206dd0e64e04b21 practicalswift: cr ACK 176325a5a47befe32d480b3dc206dd0e64e04b21 dhruv: cr ACK 176325a amitiuttarwar: ACK 176325a5a47befe32d480b3dc206dd0e64e04b21 Tree-SHA512: bd582e5e8c9eb272a5d8ec01ff07c36c0033fbb84c30d1c72c87a7a6c7290021dcaf7bf549179a8b95aeb4f7243158d5593bc7fcf1ec16213782e470fe36bb89 --- src/init.cpp | 1 - src/net_processing.cpp | 5 ----- 2 files changed, 6 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 87e55a47b2..0a9a4aed6c 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -710,7 +710,6 @@ void SetupServerArgs(NodeContext& node) argsman.AddArg("-checkmempool=", strprintf("Run checks every transactions (default: %u, regtest: %u)", defaultChainParams->DefaultConsistencyChecks(), regtestChainParams->DefaultConsistencyChecks()), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST); argsman.AddArg("-checkpoints", strprintf("Enable rejection of any forks from the known historical chain until block 1450000 (default: %u)", DEFAULT_CHECKPOINTS_ENABLED), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST); argsman.AddArg("-deprecatedrpc=", "Allows deprecated RPC method(s) to be used", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST); - argsman.AddArg("-dropmessagestest=", "Randomly drop 1 of every network messages", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST); argsman.AddArg("-limitancestorcount=", strprintf("Do not accept transactions if number of in-mempool ancestors is or more (default: %u)", DEFAULT_ANCESTOR_LIMIT), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST); argsman.AddArg("-limitancestorsize=", strprintf("Do not accept transactions whose size with all in-mempool ancestors exceeds kilobytes (default: %u)", DEFAULT_ANCESTOR_SIZE_LIMIT), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST); argsman.AddArg("-limitdescendantcount=", strprintf("Do not accept transactions if any ancestor would have or more in-mempool descendants (default: %u)", DEFAULT_DESCENDANT_LIMIT), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST); diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 7f2918bea0..737d2243ef 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -2791,11 +2791,6 @@ void PeerManagerImpl::ProcessMessage( LogPrint(BCLog::NET, "received: %s (%u bytes) peer=%d\n", SanitizeString(msg_type), vRecv.size(), pfrom.GetId()); statsClient.inc("message.received." + SanitizeString(msg_type), 1.0f); - if (gArgs.IsArgSet("-dropmessagestest") && GetRand(gArgs.GetArg("-dropmessagestest", 0)) == 0) - { - LogPrintf("dropmessagestest DROPPING RECV MESSAGE\n"); - return; - } PeerRef peer = GetPeerRef(pfrom.GetId()); if (peer == nullptr) return;