Skip to content

Commit

Permalink
Merge bitcoin#20747: net processing: Remove dropmessagestest
Browse files Browse the repository at this point in the history
176325a [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 176325a
  practicalswift:
    cr ACK 176325a
  dhruv:
    cr ACK 176325a
  amitiuttarwar:
    ACK 176325a

Tree-SHA512: bd582e5e8c9eb272a5d8ec01ff07c36c0033fbb84c30d1c72c87a7a6c7290021dcaf7bf549179a8b95aeb4f7243158d5593bc7fcf1ec16213782e470fe36bb89
  • Loading branch information
fanquake authored and PastaPastaPasta committed Aug 8, 2023
1 parent a365ed0 commit c32857c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,6 @@ void SetupServerArgs(NodeContext& node)
argsman.AddArg("-checkmempool=<n>", strprintf("Run checks every <n> 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=<method>", "Allows deprecated RPC method(s) to be used", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-dropmessagestest=<n>", "Randomly drop 1 of every <n> network messages", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-limitancestorcount=<n>", strprintf("Do not accept transactions if number of in-mempool ancestors is <n> or more (default: %u)", DEFAULT_ANCESTOR_LIMIT), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-limitancestorsize=<n>", strprintf("Do not accept transactions whose size with all in-mempool ancestors exceeds <n> kilobytes (default: %u)", DEFAULT_ANCESTOR_SIZE_LIMIT), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-limitdescendantcount=<n>", strprintf("Do not accept transactions if any ancestor would have <n> or more in-mempool descendants (default: %u)", DEFAULT_DESCENDANT_LIMIT), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
Expand Down
5 changes: 0 additions & 5 deletions src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c32857c

Please sign in to comment.