Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 3,004 Lines • ▼ Show 20 Lines | bool need_activate_chain = false; | ||||
// AcceptBlock). In this case, we need to run ActivateBestChain | // AcceptBlock). In this case, we need to run ActivateBestChain | ||||
// prior to checking the relay conditions below. | // prior to checking the relay conditions below. | ||||
need_activate_chain = true; | need_activate_chain = true; | ||||
} | } | ||||
} | } | ||||
} // release cs_main before calling ActivateBestChain | } // release cs_main before calling ActivateBestChain | ||||
if (need_activate_chain) { | if (need_activate_chain) { | ||||
BlockValidationState state; | BlockValidationState state; | ||||
if (!m_chainman.ActiveChainstate().ActivateBestChain(config, state, | if (!m_chainman.ActiveChainstate().ActivateBestChain(state, | ||||
a_recent_block)) { | a_recent_block)) { | ||||
LogPrint(BCLog::NET, "failed to activate chain (%s)\n", | LogPrint(BCLog::NET, "failed to activate chain (%s)\n", | ||||
state.ToString()); | state.ToString()); | ||||
} | } | ||||
} | } | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
const CBlockIndex *pindex = m_chainman.m_blockman.LookupBlockIndex(hash); | const CBlockIndex *pindex = m_chainman.m_blockman.LookupBlockIndex(hash); | ||||
▲ Show 20 Lines • Show All 1,994 Lines • ▼ Show 20 Lines | if (msg_type == NetMsgType::GETBLOCKS) { | ||||
{ | { | ||||
std::shared_ptr<const CBlock> a_recent_block; | std::shared_ptr<const CBlock> a_recent_block; | ||||
{ | { | ||||
LOCK(m_most_recent_block_mutex); | LOCK(m_most_recent_block_mutex); | ||||
a_recent_block = m_most_recent_block; | a_recent_block = m_most_recent_block; | ||||
} | } | ||||
BlockValidationState state; | BlockValidationState state; | ||||
if (!m_chainman.ActiveChainstate().ActivateBestChain( | if (!m_chainman.ActiveChainstate().ActivateBestChain( | ||||
config, state, a_recent_block)) { | state, a_recent_block)) { | ||||
LogPrint(BCLog::NET, "failed to activate chain (%s)\n", | LogPrint(BCLog::NET, "failed to activate chain (%s)\n", | ||||
state.ToString()); | state.ToString()); | ||||
} | } | ||||
} | } | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
// Find the last block the caller has in the main chain | // Find the last block the caller has in the main chain | ||||
▲ Show 20 Lines • Show All 1,264 Lines • ▼ Show 20 Lines | if (msg_type == NetMsgType::AVARESPONSE) { | ||||
case avalanche::VoteStatus::Stale: | case avalanche::VoteStatus::Stale: | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
if (shouldActivateBestChain) { | if (shouldActivateBestChain) { | ||||
BlockValidationState state; | BlockValidationState state; | ||||
if (!m_chainman.ActiveChainstate().ActivateBestChain(config, | if (!m_chainman.ActiveChainstate().ActivateBestChain(state)) { | ||||
state)) { | |||||
LogPrintf("failed to activate chain (%s)\n", state.ToString()); | LogPrintf("failed to activate chain (%s)\n", state.ToString()); | ||||
} | } | ||||
} | } | ||||
return; | return; | ||||
} | } | ||||
if (msg_type == NetMsgType::AVAPROOF) { | if (msg_type == NetMsgType::AVAPROOF) { | ||||
▲ Show 20 Lines • Show All 2,046 Lines • Show Last 20 Lines |