P2PServer: tweaked invalid timestamp messages

This commit is contained in:
SChernykh
2022-11-03 21:19:48 +01:00
parent 6f87546492
commit 83cda110aa
2 changed files with 9 additions and 3 deletions
+8 -2
View File
@@ -2083,9 +2083,15 @@ bool P2PServer::P2PClient::handle_incoming_block_async(const PoolBlock* block, u
if (failed) {
if (is_new) {
int64_t dt = static_cast<int64_t>(block->m_timestamp - t);
char sign = '+';
if (dt < 0) {
sign = '-';
dt = -dt;
}
LOGWARN(4, "peer " << static_cast<char*>(m_addrString)
<< " sent a block " << block->m_sidechainId << " (mined by " << block->m_minerWallet << ") with an invalid timestamp " << block->m_timestamp
<< " (your local timestamp is " << t << ")");
<< " (" << sign << dt << " seconds)");
uint32_t failed_checks = 0;
@@ -2096,7 +2102,7 @@ bool P2PServer::P2PClient::handle_incoming_block_async(const PoolBlock* block, u
}
if (failed_checks > 16) {
LOGWARN(1, "Your system clock might be invalid: " << failed_checks << " of 32 last blocks were rejected due to timestamp difference");
LOGWARN(1, "Your system clock might be invalid: " << failed_checks << " of 32 last blocks were rejected due to high timestamp diff");
}
}
return true;