Requires cs_mapNodeState.
| 55 | |
| 56 | // Requires cs_mapNodeState. |
| 57 | void MarkBlockAsInFlight(const uint256 &hash, NodeId nodeId) { |
| 58 | AssertLockHeld(cs_mapNodeState); |
| 59 | CNodeState *state = State(nodeId); |
| 60 | assert(state != nullptr); |
| 61 | |
| 62 | // Make sure it's not listed somewhere already. |
| 63 | MarkBlockAsReceived(hash); |
| 64 | |
| 65 | QueuedBlock newentry = {hash, GetTimeMicros(), state->nBlocksInFlight}; |
| 66 | if (state->nBlocksInFlight == 0) |
| 67 | state->nLastBlockReceive = newentry.nTime; // Reset when a first request is sent. |
| 68 | |
| 69 | list<QueuedBlock>::iterator it = state->vBlocksInFlight.insert(state->vBlocksInFlight.end(), newentry); |
| 70 | state->nBlocksInFlight++; |
| 71 | mapBlocksInFlight[hash] = std::make_tuple(nodeId, it, GetTimeMicros()); |
| 72 | } |
| 73 | |
| 74 | void ProcessGetData(CNode *pFrom) { |
| 75 | deque<CInv>::iterator it = pFrom->vRecvGetData.begin(); |
no test coverage detected