|
|
@ -281,6 +281,7 @@ void FinalizeNode(NodeId nodeid, bool& fUpdateConnectionTime) { |
|
|
|
fUpdateConnectionTime = false; |
|
|
|
fUpdateConnectionTime = false; |
|
|
|
LOCK(cs_main); |
|
|
|
LOCK(cs_main); |
|
|
|
CNodeState *state = State(nodeid); |
|
|
|
CNodeState *state = State(nodeid); |
|
|
|
|
|
|
|
assert(state != nullptr); |
|
|
|
|
|
|
|
|
|
|
|
if (state->fSyncStarted) |
|
|
|
if (state->fSyncStarted) |
|
|
|
nSyncStarted--; |
|
|
|
nSyncStarted--; |
|
|
@ -315,6 +316,7 @@ bool MarkBlockAsReceived(const uint256& hash) { |
|
|
|
std::map<uint256, std::pair<NodeId, std::list<QueuedBlock>::iterator> >::iterator itInFlight = mapBlocksInFlight.find(hash); |
|
|
|
std::map<uint256, std::pair<NodeId, std::list<QueuedBlock>::iterator> >::iterator itInFlight = mapBlocksInFlight.find(hash); |
|
|
|
if (itInFlight != mapBlocksInFlight.end()) { |
|
|
|
if (itInFlight != mapBlocksInFlight.end()) { |
|
|
|
CNodeState *state = State(itInFlight->second.first); |
|
|
|
CNodeState *state = State(itInFlight->second.first); |
|
|
|
|
|
|
|
assert(state != nullptr); |
|
|
|
state->nBlocksInFlightValidHeaders -= itInFlight->second.second->fValidatedHeaders; |
|
|
|
state->nBlocksInFlightValidHeaders -= itInFlight->second.second->fValidatedHeaders; |
|
|
|
if (state->nBlocksInFlightValidHeaders == 0 && itInFlight->second.second->fValidatedHeaders) { |
|
|
|
if (state->nBlocksInFlightValidHeaders == 0 && itInFlight->second.second->fValidatedHeaders) { |
|
|
|
// Last validated block on the queue was received.
|
|
|
|
// Last validated block on the queue was received.
|
|
|
|