p2p, refactor: Extend logs for unexpected sendtxrcncl

This commit is contained in:
Gleb Naumenko 2022-10-25 11:44:11 +03:00
parent 87493e112e
commit 14263c13f1
2 changed files with 14 additions and 0 deletions

View File

@ -3526,6 +3526,8 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
peer_txreconcl_version, remote_salt);
switch (result) {
case ReconciliationRegisterResult::NOT_FOUND:
LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "Ignore unexpected txreconciliation signal from peer=%d\n", pfrom.GetId());
break;
case ReconciliationRegisterResult::SUCCESS:
break;
case ReconciliationRegisterResult::ALREADY_REGISTERED:

View File

@ -155,6 +155,18 @@ class SendTxRcnclTest(BitcoinTestFramework):
peer.send_message(sendtxrcncl_higher_version)
self.nodes[0].disconnect_p2ps()
self.log.info('unexpected SENDTXRCNCL is ignored')
peer = self.nodes[0].add_p2p_connection(PeerNoVerack(), send_version=False, wait_for_verack=False)
old_version_msg = msg_version()
old_version_msg.nVersion = 70015
old_version_msg.strSubVer = P2P_SUBVERSION
old_version_msg.nServices = P2P_SERVICES
old_version_msg.relay = 1
peer.send_message(old_version_msg)
with self.nodes[0].assert_debug_log(['Ignore unexpected txreconciliation signal from peer=2']):
peer.send_message(create_sendtxrcncl_msg())
self.nodes[0].disconnect_p2ps()
self.log.info('sending SENDTXRCNCL after sending VERACK triggers a disconnect')
peer = self.nodes[0].add_p2p_connection(P2PInterface())
with self.nodes[0].assert_debug_log(["sendtxrcncl received after verack"]):