Skip to content

Commit 661fe5d

Browse files
committed
Merge #20146: net: Send post-verack handshake messages at most once
fa1f6f2 net: Send post-verack handshake messages at most once (MarcoFalke) Pull request description: There is no need to send `SENDHEADERS` and `SENDCMPCT` messages as a reply to each `VERACK` that is received. For alive checks, a `PING`/`PONG` can be used. ACKs for top commit: jonatack: Concept ACK fa1f6f2 this is the only code section that sets `fCurrentlyConnected` and `fSuccessfullyConnected` to true. Could add a test. I did not verify if this code is actually being called repeatedly post initial verack; was it? hebasto: ACK fa1f6f2, I have reviewed the code and it looks OK, I agree it can be merged. naumenkogs: ACK fa1f6f2 laanwj: Code review ACK fa1f6f2 Tree-SHA512: c841d5d3807254a49463bbcfac3b32881b34a9d3206899544c86322c20988e17ad2ae243cba227fd3825a914f0cb2584451edda2414aecee6d5e3f5a0636f08a
2 parents c2c4dba + fa1f6f2 commit 661fe5d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/net_processing.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2462,8 +2462,9 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
24622462
// At this point, the outgoing message serialization version can't change.
24632463
const CNetMsgMaker msgMaker(pfrom.GetCommonVersion());
24642464

2465-
if (msg_type == NetMsgType::VERACK)
2466-
{
2465+
if (msg_type == NetMsgType::VERACK) {
2466+
if (pfrom.fSuccessfullyConnected) return;
2467+
24672468
if (!pfrom.IsInboundConn()) {
24682469
// Mark this node as currently connected, so we update its timestamp later.
24692470
LOCK(cs_main);

0 commit comments

Comments
 (0)