P2PServer: relax stale block restriction

This commit is contained in:
SChernykh 2021-09-13 19:25:12 +02:00
parent 14e26f5c17
commit ba6a2c8eb2

View file

@ -1421,7 +1421,7 @@ bool P2PServer::P2PClient::on_block_broadcast(const uint8_t* buf, uint32_t size)
if (our_height - peer_height < 5) { if (our_height - peer_height < 5) {
using namespace std::chrono; using namespace std::chrono;
const int64_t elapsed_ms = duration_cast<milliseconds>(system_clock::now() - miner_data.time_received).count(); const int64_t elapsed_ms = duration_cast<milliseconds>(system_clock::now() - miner_data.time_received).count();
if ((our_height - peer_height > 1) || (elapsed_ms >= 1000)) { if (our_height - peer_height > 1) {
LOGWARN(5, "peer " << static_cast<char*>(m_addrString) << " broadcasted a stale block (" << elapsed_ms << " ms late, mainchain height " << peer_height << ", expected >= " << our_height << "), ignoring it"); LOGWARN(5, "peer " << static_cast<char*>(m_addrString) << " broadcasted a stale block (" << elapsed_ms << " ms late, mainchain height " << peer_height << ", expected >= " << our_height << "), ignoring it");
return true; return true;
} }