Check whether the last unknown block a peer advertized is not yet known. */
| 424 | |
| 425 | /** Check whether the last unknown block a peer advertized is not yet known. */ |
| 426 | void ProcessBlockAvailability(NodeId nodeid) |
| 427 | { |
| 428 | CNodeState* state = State(nodeid); |
| 429 | assert(state != NULL); |
| 430 | |
| 431 | if (state->hashLastUnknownBlock != 0) { |
| 432 | CBlockIndex* pindex = LookupBlockIndex(state->hashLastUnknownBlock); |
| 433 | if (pindex && pindex->nChainWork > 0) { |
| 434 | if (state->pindexBestKnownBlock == NULL || pindex->nChainWork >= state->pindexBestKnownBlock->nChainWork) |
| 435 | state->pindexBestKnownBlock = pindex; |
| 436 | state->hashLastUnknownBlock = uint256(0); |
| 437 | } |
| 438 | } |
| 439 | } |
| 440 | |
| 441 | /** Update tracking information about which blocks a peer is assumed to have. */ |
| 442 | void UpdateBlockAvailability(NodeId nodeid, const uint256& hash) |
no test coverage detected