mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-12-22 19:39:22 +00:00
SideChain: recover from incorrect PoW calculation
This commit is contained in:
parent
9927718e25
commit
950330b5f7
1 changed files with 9 additions and 1 deletions
|
@ -602,13 +602,21 @@ bool SideChain::add_external_block(PoolBlock& block, std::vector<hash>& missing_
|
|||
", mainchain height = " << block.m_txinGenHeight
|
||||
);
|
||||
|
||||
bool not_enough_pow = true;
|
||||
|
||||
// Calculate the same hash second time to check if it's an unstable hardware that caused this
|
||||
hash pow_hash2;
|
||||
if (block.get_pow_hash(m_pool->hasher(), block.m_txinGenHeight, seed, pow_hash2, true) && (pow_hash2 != pow_hash)) {
|
||||
LOGERR(0, "UNSTABLE HARDWARE DETECTED: Calculated the same hash twice, got different results: " << pow_hash << " != " << pow_hash2 << " (sidechain id = " << block.m_sidechainId << ')');
|
||||
if (block.m_difficulty.check_pow(pow_hash2)) {
|
||||
LOGINFO(3, "add_external_block second result has enough PoW for height = " << block.m_sidechainHeight << ", id = " << block.m_sidechainId);
|
||||
not_enough_pow = false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
if (not_enough_pow) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool block_found = false;
|
||||
|
|
Loading…
Reference in a new issue