Skip to content

Commit 42326b0

Browse files
committed
Merge bitcoin/bitcoin#30512: net: Log accepted connection after m_nodes.push_back; Fix intermittent test issue
fa3ea3b test: Fix intermittent issue in p2p_v2_misbehaving.py (MarcoFalke) 5555557 net: Log accepted connection after m_nodes.push_back (MarcoFalke) Pull request description: Fix the two issues reported in https://github.com/bitcoin/bitcoin/pull/30468/files#r1688444784: * Delay a debug log line for consistency. * Fix an intermittent test issue. They are completely separate fixes, but both `net` related. ACKs for top commit: 0xB10C: Code Review ACK fa3ea3b stratospher: tested ACK fa3ea3b. Tree-SHA512: cd6b6e164b317058a305a5c3e38c56c9a814a7469039e1143f1d7addfbc91b0a28506873356b373d97448b46cb6fbe94a1309df82e34c855540b241a09489e8b
2 parents d15d95c + fa3ea3b commit 42326b0

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/net.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,13 +1810,11 @@ void CConnman::CreateNodeFromAcceptedSocket(std::unique_ptr<Sock>&& sock,
18101810
});
18111811
pnode->AddRef();
18121812
m_msgproc->InitializeNode(*pnode, nLocalServices);
1813-
1814-
LogPrint(BCLog::NET, "connection from %s accepted\n", addr.ToStringAddrPort());
1815-
18161813
{
18171814
LOCK(m_nodes_mutex);
18181815
m_nodes.push_back(pnode);
18191816
}
1817+
LogDebug(BCLog::NET, "connection from %s accepted\n", addr.ToStringAddrPort());
18201818

18211819
// We received a new connection, harvest entropy from the time (and our peer count)
18221820
RandAddEvent((uint32_t)id);

test/functional/p2p_v2_misbehaving.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ def test_earlykeyresponse(self):
140140
node0.setmocktime(int(time.time()))
141141
self.log.info('Sending first 4 bytes of ellswift which match network magic')
142142
self.log.info('If a response is received, assertion failure would happen in our custom data_received() function')
143-
peer1 = node0.add_p2p_connection(MisbehavingV2Peer(TestType.EARLY_KEY_RESPONSE), wait_for_verack=False, send_version=False, supports_v2_p2p=True, wait_for_v2_handshake=False)
143+
with node0.wait_for_new_peer():
144+
peer1 = node0.add_p2p_connection(MisbehavingV2Peer(TestType.EARLY_KEY_RESPONSE), wait_for_verack=False, send_version=False, supports_v2_p2p=True, wait_for_v2_handshake=False)
144145
peer1.send_raw_message(MAGIC_BYTES['regtest'])
145146
self.log.info('Sending remaining ellswift and garbage which are different from V1_PREFIX. Since a response is')
146147
self.log.info('expected now, our custom data_received() function wouldn\'t result in assertion failure')

0 commit comments

Comments
 (0)