mirror of
https://github.com/SChernykh/p2pool.git
synced 2025-03-28 18:08:47 +00:00
P2PServer: tweaked invalid timestamp messages
This commit is contained in:
parent
6f87546492
commit
83cda110aa
2 changed files with 9 additions and 3 deletions
|
@ -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;
|
||||
|
|
|
@ -222,7 +222,7 @@ void Wallet::encode(char (&buf)[ADDRESS_LENGTH]) const
|
|||
for (int j = 0; (j < 8) && (i * sizeof(uint64_t) + j < sizeof(data)); ++j) {
|
||||
n = (n << 8) | data[i * sizeof(uint64_t) + j];
|
||||
}
|
||||
for (int j = (((i < num_full_blocks) ? block_sizes.back() : last_block_size)) - 1; j >= 0; --j) {
|
||||
for (int j = ((i < num_full_blocks) ? block_sizes.back() : last_block_size) - 1; j >= 0; --j) {
|
||||
const int digit = n % alphabet_size;
|
||||
n /= alphabet_size;
|
||||
buf[i * block_sizes.back() + j] = alphabet[digit];
|
||||
|
|
Loading…
Reference in a new issue