| 322 | struct MarkBlockAsInFlight : public BlockInFlightMarker { |
| 323 | |
| 324 | void operator()(NodeId nodeid, const uint256& hash, const Consensus::Params& consensusParams, CBlockIndex *pindex = NULL) { |
| 325 | AssertLockHeld(cs_main); |
| 326 | |
| 327 | NodeStatePtr state(nodeid); |
| 328 | assert(!state.IsNull()); |
| 329 | |
| 330 | int64_t nNow = GetTimeMicros(); |
| 331 | QueuedBlock newentry = {hash, pindex, nNow, pindex != NULL, GetBlockTimeout(nNow, nQueuedValidatedHeaders, consensusParams), nodeid}; |
| 332 | nQueuedValidatedHeaders += newentry.fValidatedHeaders; |
| 333 | list<QueuedBlock>::iterator it = state->vBlocksInFlight.insert(state->vBlocksInFlight.end(), newentry); |
| 334 | state->nBlocksInFlight++; |
| 335 | state->nBlocksInFlightValidHeaders += newentry.fValidatedHeaders; |
| 336 | blocksInFlight.insert(it); |
| 337 | }; |
| 338 | }; |
| 339 | |
| 340 | /** Check whether the last unknown block a peer advertized is not yet known. */ |
nothing calls this directly
no test coverage detected