mirror of
https://github.com/SChernykh/p2pool.git
synced 2025-01-03 17:29:24 +00:00
Fixed missing blocks download logic
This commit is contained in:
parent
5cea7be405
commit
eb3a3872eb
2 changed files with 4 additions and 1 deletions
|
@ -209,6 +209,8 @@ struct difficulty_type
|
||||||
|
|
||||||
FORCEINLINE double to_double() const { return static_cast<double>(hi) * 18446744073709551616.0 + static_cast<double>(lo); }
|
FORCEINLINE double to_double() const { return static_cast<double>(hi) * 18446744073709551616.0 + static_cast<double>(lo); }
|
||||||
|
|
||||||
|
FORCEINLINE bool empty() const { return (lo == 0) && (hi == 0); }
|
||||||
|
|
||||||
// Finds a 64-bit target for mining (target = 2^64 / difficulty) and rounds up the result of division
|
// Finds a 64-bit target for mining (target = 2^64 / difficulty) and rounds up the result of division
|
||||||
// Because of that, there's a very small chance that miners will find a hash that meets the target but is still wrong (hash * difficulty >= 2^256)
|
// Because of that, there's a very small chance that miners will find a hash that meets the target but is still wrong (hash * difficulty >= 2^256)
|
||||||
// A proper difficulty check is in check_pow()
|
// A proper difficulty check is in check_pow()
|
||||||
|
|
|
@ -302,7 +302,8 @@ void p2pool::handle_miner_data(MinerData& data)
|
||||||
WriteLock lock(m_mainchainLock);
|
WriteLock lock(m_mainchainLock);
|
||||||
|
|
||||||
for (uint64_t h = data.height; h && (h + BLOCK_HEADERS_REQUIRED > data.height); --h) {
|
for (uint64_t h = data.height; h && (h + BLOCK_HEADERS_REQUIRED > data.height); --h) {
|
||||||
if (m_mainchainByHeight.find(h) == m_mainchainByHeight.end()) {
|
auto it = m_mainchainByHeight.find(h);
|
||||||
|
if ((it == m_mainchainByHeight.end()) || it->second.difficulty.empty()) {
|
||||||
LOGWARN(3, "Mainchain data for height " << h << " is missing, requesting it from monerod again");
|
LOGWARN(3, "Mainchain data for height " << h << " is missing, requesting it from monerod again");
|
||||||
missing_heights.push_back(h);
|
missing_heights.push_back(h);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue