More time handling fixes

This commit is contained in:
SChernykh
2022-03-23 15:49:24 +01:00
parent ef15c3b54f
commit 0c2b7d6010
5 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -1713,7 +1713,7 @@ bool P2PServer::P2PClient::on_block_broadcast(const uint8_t* buf, uint32_t size)
if (peer_height < our_height) {
if (our_height - peer_height < 5) {
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>(high_resolution_clock::now() - miner_data.time_received).count();
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");
return true;