Check whether the last unknown block a peer advertised is not yet known. */
| 398 | |
| 399 | /** Check whether the last unknown block a peer advertised is not yet known. */ |
| 400 | void ProcessBlockAvailability(NodeId nodeid) { |
| 401 | CNodeState *state = State(nodeid); |
| 402 | assert(state != NULL); |
| 403 | |
| 404 | if (!state->hashLastUnknownBlock.IsNull()) { |
| 405 | BlockMap::iterator itOld = mapBlockIndex.find(state->hashLastUnknownBlock); |
| 406 | if (itOld != mapBlockIndex.end() && itOld->second->nChainWork > 0) { |
| 407 | if (state->pindexBestKnownBlock == NULL || itOld->second->nChainWork >= state->pindexBestKnownBlock->nChainWork) |
| 408 | state->pindexBestKnownBlock = itOld->second; |
| 409 | state->hashLastUnknownBlock.SetNull(); |
| 410 | } |
| 411 | } |
| 412 | } |
| 413 | |
| 414 | /** Update tracking information about which blocks a peer is assumed to have. */ |
| 415 | void UpdateBlockAvailability(NodeId nodeid, const uint256 &hash) { |
no test coverage detected