mirror of
https://github.com/SChernykh/p2pool.git
synced 2025-03-24 08:09:02 +00:00
Ignore shares from peers who have lagging monerod
More than 10 seconds lag is unacceptable
This commit is contained in:
parent
fd27ea0e8f
commit
220c6939b1
1 changed files with 1 additions and 4 deletions
|
@ -1980,13 +1980,10 @@ 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>(high_resolution_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) {
|
if ((our_height - peer_height > 1) || (elapsed_ms > 10000)) {
|
||||||
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;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
LOGINFO(5, "peer " << static_cast<char*>(m_addrString) << " broadcasted a stale block (" << elapsed_ms << " ms late, mainchain height " << peer_height << ", expected >= " << our_height << ")");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOGWARN(4, "peer " << static_cast<char*>(m_addrString) << " broadcasted an unreasonably stale block (mainchain height " << peer_height << ", expected >= " << our_height << ')');
|
LOGWARN(4, "peer " << static_cast<char*>(m_addrString) << " broadcasted an unreasonably stale block (mainchain height " << peer_height << ", expected >= " << our_height << ')');
|
||||||
|
|
Loading…
Reference in a new issue