Requires cs_main. returns false, still setting pit, if the block was already in flight from the same peer pit will only be valid as long as the same cs_main lock is being held
| 408 | // returns false, still setting pit, if the block was already in flight from the same peer |
| 409 | // pit will only be valid as long as the same cs_main lock is being held |
| 410 | void MarkBlockAsInFlight(NodeId nodeid, const uint256& hash, const Consensus::Params& consensusParams, CBlockIndex* pindex = NULL) |
| 411 | { |
| 412 | CNodeState* state = State(nodeid); |
| 413 | assert(state != NULL); |
| 414 | |
| 415 | // Make sure it's not listed somewhere already. |
| 416 | MarkBlockAsReceived(hash); |
| 417 | |
| 418 | QueuedBlock newentry = {hash, pindex, GetTimeMicros(), nQueuedValidatedHeaders, pindex != NULL}; |
| 419 | nQueuedValidatedHeaders += newentry.fValidatedHeaders; |
| 420 | list<QueuedBlock>::iterator it = state->vBlocksInFlight.insert(state->vBlocksInFlight.end(), newentry); |
| 421 | state->nBlocksInFlight++; |
| 422 | mapBlocksInFlight[hash] = std::make_pair(nodeid, it); |
| 423 | } |
| 424 | |
| 425 | /** Check whether the last unknown block a peer advertized is not yet known. */ |
| 426 | void ProcessBlockAvailability(NodeId nodeid) |
no test coverage detected