fixed version handshake and display
This commit is contained in:
@@ -1268,6 +1268,7 @@ void P2PServer::show_peers() const
|
||||
case PROTOCOL_VERSION_1_2: s << " p1.2"; break;
|
||||
case PROTOCOL_VERSION_1_3: s << " p1.3"; break;
|
||||
case PROTOCOL_VERSION_1_4: s << " p1.4"; break;
|
||||
case PROTOCOL_VERSION_1_5: s << " p1.5"; break;
|
||||
default: s << " p?"; break;
|
||||
}
|
||||
}
|
||||
@@ -2660,12 +2661,6 @@ void P2PServer::P2PClient::on_after_handshake(uint8_t* &p)
|
||||
p += sizeof(uint32_t);
|
||||
}
|
||||
|
||||
// Request checkpoints from peer (CAP exchange)
|
||||
// Only send to peers with protocol 1.5+ to avoid disconnects with older nodes
|
||||
if (m_protocolVersion >= PROTOCOL_VERSION_1_5) {
|
||||
LOGINFO(5, "sending CHECKPOINT_REQUEST to " << static_cast<char*>(m_addrString));
|
||||
*(p++) = static_cast<uint8_t>(MessageId::CHECKPOINT_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
bool P2PServer::P2PClient::on_listen_port(const uint8_t* buf)
|
||||
@@ -3030,6 +3025,23 @@ void P2PServer::P2PClient::on_peer_list_response(const uint8_t* buf)
|
||||
server->send_aux_job_donation(this, server->m_auxJobLastMessage.data(), static_cast<uint32_t>(server->m_auxJobLastMessage.size()));
|
||||
}
|
||||
}
|
||||
|
||||
// Request checkpoints from peer (CAP exchange)
|
||||
if (m_protocolVersion >= PROTOCOL_VERSION_1_5) {
|
||||
LOGINFO(5, "sending CHECKPOINT_REQUEST to " << static_cast<char*>(m_addrString));
|
||||
const bool result = server->send(this,
|
||||
[](uint8_t* buf, size_t buf_size) -> size_t
|
||||
{
|
||||
if (buf_size < 1) {
|
||||
return 0;
|
||||
}
|
||||
buf[0] = static_cast<uint8_t>(MessageId::CHECKPOINT_REQUEST);
|
||||
return 1;
|
||||
});
|
||||
if (!result) {
|
||||
LOGWARN(3, "Failed to send CHECKPOINT_REQUEST to " << static_cast<char*>(m_addrString));
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user