test: Functional test for opportunistic encryption

Co-authored-by: Pieter Wuille <bitcoin-dev@wuille.net>
This commit is contained in:
dhruv
2022-09-07 15:59:49 -07:00
committed by Pieter Wuille
parent b815cce50e
commit 05d19fbcc1
3 changed files with 121 additions and 13 deletions

View File

@@ -1552,6 +1552,10 @@ void V2Transport::MarkBytesSent(size_t bytes_sent) noexcept
LOCK(m_send_mutex);
if (m_send_state == SendState::V1) return m_v1_fallback.MarkBytesSent(bytes_sent);
if (m_send_state == SendState::AWAITING_KEY && m_send_pos == 0 && bytes_sent > 0) {
LogPrint(BCLog::NET, "start sending v2 handshake to peer=%d\n", m_nodeid);
}
m_send_pos += bytes_sent;
Assume(m_send_pos <= m_send_buffer.size());
if (m_send_pos >= CMessageHeader::HEADER_SIZE) {