MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / MarkBlockAsInFlight

Function MarkBlockAsInFlight

src/p2p/chainmessage.cpp:57–72  ·  view source on GitHub ↗

Requires cs_mapNodeState.

Source from the content-addressed store, hash-verified

55
56// Requires cs_mapNodeState.
57void 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
74void ProcessGetData(CNode *pFrom) {
75 deque<CInv>::iterator it = pFrom->vRecvGetData.begin();

Callers 1

SendMessagesFunction · 0.85

Calls 5

MarkBlockAsReceivedFunction · 0.85
StateFunction · 0.70
GetTimeMicrosFunction · 0.50
insertMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected