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

Function PushGetBlocks

src/main.cpp:2059–2072  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2057}
2058
2059void PushGetBlocks(CNode *pNode, CBlockIndex *pIndexBegin, uint256 hashEnd) {
2060 // Ask this guy to fill in what we're missing
2061 AssertLockHeld(cs_main);
2062 // Filter out duplicate requests
2063 if (pIndexBegin == pNode->pIndexLastGetBlocksBegin && hashEnd == pNode->hashLastGetBlocksEnd) {
2064 LogPrint(BCLog::NET, "filter the same GetLocator from peer %s\n", pNode->addr.ToString());
2065 return;
2066 }
2067 pNode->pIndexLastGetBlocksBegin = pIndexBegin;
2068 pNode->hashLastGetBlocksEnd = hashEnd;
2069 CBlockLocator blockLocator = chainActive.GetLocator(pIndexBegin);
2070 pNode->PushMessage(NetMsgType::GETBLOCKS, blockLocator, hashEnd);
2071 LogPrint(BCLog::NET, "getblocks from peer %s, hashEnd:%s\n", pNode->addr.ToString(), hashEnd.GetHex());
2072}
2073
2074void PushGetBlocksOnCondition(CNode *pNode, CBlockIndex *pIndexBegin, uint256 hashEnd) {
2075 // Ask this guy to fill in what we're missing

Callers 1

SendMessagesFunction · 0.85

Calls 4

GetLocatorMethod · 0.80
PushMessageMethod · 0.80
ToStringMethod · 0.45
GetHexMethod · 0.45

Tested by

no test coverage detected