mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-12-22 11:29:23 +00:00
Fixed cppcheck errors
This commit is contained in:
parent
4741880044
commit
1b5860eec8
2 changed files with 8 additions and 5 deletions
|
@ -1724,7 +1724,7 @@ PoolBlock* SideChain::get_parent(const PoolBlock* block) const
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SideChain::is_longer_chain(const PoolBlock* block, const PoolBlock* candidate, bool& is_alternative)
|
bool SideChain::is_longer_chain(const PoolBlock* block, const PoolBlock* candidate, bool& is_alternative) const
|
||||||
{
|
{
|
||||||
is_alternative = false;
|
is_alternative = false;
|
||||||
|
|
||||||
|
@ -1834,7 +1834,11 @@ bool SideChain::is_longer_chain(const PoolBlock* block, const PoolBlock* candida
|
||||||
void SideChain::update_depths(PoolBlock* block)
|
void SideChain::update_depths(PoolBlock* block)
|
||||||
{
|
{
|
||||||
for (size_t i = 1; i <= UNCLE_BLOCK_DEPTH; ++i) {
|
for (size_t i = 1; i <= UNCLE_BLOCK_DEPTH; ++i) {
|
||||||
for (PoolBlock* child : m_blocksByHeight[block->m_sidechainHeight + i]) {
|
auto it = m_blocksByHeight.find(block->m_sidechainHeight + i);
|
||||||
|
if (it == m_blocksByHeight.end()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (PoolBlock* child : it->second) {
|
||||||
if (child->m_parent == block->m_sidechainId) {
|
if (child->m_parent == block->m_sidechainId) {
|
||||||
if (i != 1) {
|
if (i != 1) {
|
||||||
LOGERR(1, "m_blocksByHeight is inconsistent with child->m_parent. Fix the code!");
|
LOGERR(1, "m_blocksByHeight is inconsistent with child->m_parent. Fix the code!");
|
||||||
|
@ -1844,8 +1848,7 @@ void SideChain::update_depths(PoolBlock* block)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto it = std::find(child->m_uncles.begin(), child->m_uncles.end(), block->m_sidechainId);
|
if (std::find(child->m_uncles.begin(), child->m_uncles.end(), block->m_sidechainId) != child->m_uncles.end()) {
|
||||||
if (it != child->m_uncles.end()) {
|
|
||||||
block->m_depth = std::max(block->m_depth, child->m_depth + i);
|
block->m_depth = std::max(block->m_depth, child->m_depth + i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ private:
|
||||||
PoolBlock* get_parent(const PoolBlock* block) const;
|
PoolBlock* get_parent(const PoolBlock* block) const;
|
||||||
|
|
||||||
// Checks if "candidate" has longer (higher difficulty) chain than "block"
|
// Checks if "candidate" has longer (higher difficulty) chain than "block"
|
||||||
bool is_longer_chain(const PoolBlock* block, const PoolBlock* candidate, bool& is_alternative);
|
bool is_longer_chain(const PoolBlock* block, const PoolBlock* candidate, bool& is_alternative) const;
|
||||||
void update_depths(PoolBlock* block);
|
void update_depths(PoolBlock* block);
|
||||||
void prune_old_blocks();
|
void prune_old_blocks();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue