You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
46339d2 test, refactor: Reorder sendtxrcncl tests for better readability (Gleb Naumenko)
14263c1 p2p, refactor: Extend logs for unexpected sendtxrcncl (Gleb Naumenko)
87493e1 p2p, test, refactor: Minor code improvements (Gleb Naumenko)
00c5dec p2p: Clarify sendtxrcncl policies (Gleb Naumenko)
ac6ee5b test: Expand unit and functional tests for txreconciliation (Gleb Naumenko)
bc84e24 p2p, refactor: Switch to enum class for ReconciliationRegisterResult (Gleb Naumenko)
a60f729 p2p: Drop roles from sendtxrcncl (Gleb Naumenko)
6772cbf tests: stabilize sendtxrcncl test (Gleb Naumenko)
Pull request description:
Non-trivial changes include:
- Getting rid of roles in `sendtxrcncl` message (summarized in the [BIP PR](bitcoin/bips#1376));
- Disconnect the peer if it send `sendtxrcncl` although we are in `blocksonly` and notified the peer with `fRelay=0`;
- Don't send `sendtxrcncl` to feeler connections.
ACKs for top commit:
vasild:
ACK 46339d2
ariard:
ACK 46339d2
mzumsande:
Code Review ACK 46339d2
Tree-SHA512: b5cc6934b4670c12b7dbb3189e739ef747ee542ec56678bf4e4355bfb481b746d32363c173635685b71969b3fe4bd52b1c8ebd3ea3b35c82044bba69220f6417
argsman.AddArg("-onlynet=<net>", "Make automatic outbound connections only to network <net> (" + Join(GetNetworkNames(), ", ") + "). Inbound and manual connections are not affected by this option. It can be specified multiple times to allow multiple networks.", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
478
478
argsman.AddArg("-peerbloomfilters", strprintf("Support filtering of blocks and transaction with bloom filters (default: %u)", DEFAULT_PEERBLOOMFILTERS), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
479
479
argsman.AddArg("-peerblockfilters", strprintf("Serve compact block filters to peers per BIP 157 (default: %u)", DEFAULT_PEERBLOCKFILTERS), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
// TODO: remove the sentence "Nodes not using ... incoming connections." once the changes from
481
482
// https://github.com/bitcoin/bitcoin/pull/23542 have become widespread.
482
483
argsman.AddArg("-port=<port>", strprintf("Listen for connections on <port>. Nodes not using the default ports (default: %u, testnet: %u, signet: %u, regtest: %u) are unlikely to get incoming connections. Not relevant for I2P (see doc/i2p.md).", defaultChainParams->GetDefaultPort(), testnetChainParams->GetDefaultPort(), signetChainParams->GetDefaultPort(), regtestChainParams->GetDefaultPort()), ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::CONNECTION);
argsman.AddArg("-seednode=<ip>", "Connect to a node to retrieve peer addresses, and disconnect. This option can be specified multiple times to connect to multiple nodes.", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
486
487
argsman.AddArg("-networkactive", "Enable all P2P network activity (default: 1). Can be changed by the setnetworkactive RPC command", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
487
488
argsman.AddArg("-timeout=<n>", strprintf("Specify socket connection timeout in milliseconds. If an initial attempt to connect is unsuccessful after this amount of time, drop it (minimum: 1, default: %d)", DEFAULT_CONNECT_TIMEOUT), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
argsman.AddArg("-peertimeout=<n>", strprintf("Specify a p2p connection timeout delay in seconds. After connecting to a peer, wait this amount of time before considering disconnection based on inactivity (minimum: 1, default: %d)", DEFAULT_PEER_CONNECT_TIMEOUT), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CONNECTION);
490
490
argsman.AddArg("-torcontrol=<ip>:<port>", strprintf("Tor control port to use if onion listening enabled (default: %s)", DEFAULT_TOR_CONTROL), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
491
491
argsman.AddArg("-torpassword=<pass>", "Tor control port password (default: empty)", ArgsManager::ALLOW_ANY | ArgsManager::SENSITIVE, OptionsCategory::CONNECTION);
if (m_txreconciliation->IsPeerRegistered(pfrom.GetId())) {
3523
-
// A peer is already registered, meaning we already received SENDTXRCNCL from them.
3525
+
const ReconciliationRegisterResult result = m_txreconciliation->RegisterPeer(pfrom.GetId(), pfrom.IsInboundConn(),
3526
+
peer_txreconcl_version, remote_salt);
3527
+
switch (result) {
3528
+
case ReconciliationRegisterResult::NOT_FOUND:
3529
+
LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "Ignore unexpected txreconciliation signal from peer=%d\n", pfrom.GetId());
3530
+
break;
3531
+
case ReconciliationRegisterResult::SUCCESS:
3532
+
break;
3533
+
case ReconciliationRegisterResult::ALREADY_REGISTERED:
3524
3534
LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "txreconciliation protocol violation from peer=%d (sendtxrcncl received from already registered peer); disconnecting\n", pfrom.GetId());
3525
3535
pfrom.fDisconnect = true;
3526
3536
return;
3527
-
}
3528
-
3529
-
const ReconciliationRegisterResult result = m_txreconciliation->RegisterPeer(pfrom.GetId(), pfrom.IsInboundConn(),
3530
-
is_peer_initiator, is_peer_responder,
3531
-
peer_txreconcl_version,
3532
-
remote_salt);
3533
-
3534
-
// If it's a protocol violation, disconnect.
3535
-
// If the peer was not found (but something unexpected happened) or it was registered,
3536
-
// nothing to be done.
3537
-
if (result == ReconciliationRegisterResult::PROTOCOL_VIOLATION) {
3537
+
case ReconciliationRegisterResult::PROTOCOL_VIOLATION:
3538
3538
LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "txreconciliation protocol violation from peer=%d; disconnecting\n", pfrom.GetId());
0 commit comments