|
|
|
@ -1475,7 +1475,7 @@ static void RelayAddress(const CNode& originator,
|
|
|
|
|
connman.ForEachNodeThen(std::move(sortfunc), std::move(pushfunc));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void static ProcessGetBlockData(CNode& pfrom, const CChainParams& chainparams, const CInv& inv, CConnman& connman)
|
|
|
|
|
void static ProcessGetBlockData(CNode& pfrom, Peer& peer, const CChainParams& chainparams, const CInv& inv, CConnman& connman)
|
|
|
|
|
{
|
|
|
|
|
bool send = false;
|
|
|
|
|
std::shared_ptr<const CBlock> a_recent_block;
|
|
|
|
@ -1616,15 +1616,14 @@ void static ProcessGetBlockData(CNode& pfrom, const CChainParams& chainparams, c
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Trigger the peer node to send a getblocks request for the next batch of inventory
|
|
|
|
|
if (inv.hash == pfrom.hashContinue)
|
|
|
|
|
{
|
|
|
|
|
if (inv.hash == peer.m_continuation_block) {
|
|
|
|
|
// Send immediately. This must send even if redundant,
|
|
|
|
|
// and we want it right after the last block so they don't
|
|
|
|
|
// wait for other stuff first.
|
|
|
|
|
std::vector<CInv> vInv;
|
|
|
|
|
vInv.push_back(CInv(MSG_BLOCK, ::ChainActive().Tip()->GetBlockHash()));
|
|
|
|
|
connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::INV, vInv));
|
|
|
|
|
pfrom.hashContinue.SetNull();
|
|
|
|
|
peer.m_continuation_block.SetNull();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1724,7 +1723,7 @@ void static ProcessGetData(CNode& pfrom, Peer& peer, const CChainParams& chainpa
|
|
|
|
|
if (it != peer.m_getdata_requests.end() && !pfrom.fPauseSend) {
|
|
|
|
|
const CInv &inv = *it++;
|
|
|
|
|
if (inv.IsGenBlkMsg()) {
|
|
|
|
|
ProcessGetBlockData(pfrom, chainparams, inv, connman);
|
|
|
|
|
ProcessGetBlockData(pfrom, peer, chainparams, inv, connman);
|
|
|
|
|
}
|
|
|
|
|
// else: If the first item on the queue is an unknown type, we erase it
|
|
|
|
|
// and continue processing the queue on the next call.
|
|
|
|
@ -2805,7 +2804,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
|
|
|
|
|
// When this block is requested, we'll send an inv that'll
|
|
|
|
|
// trigger the peer to getblocks the next batch of inventory.
|
|
|
|
|
LogPrint(BCLog::NET, " getblocks stopping at limit %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString());
|
|
|
|
|
pfrom.hashContinue = pindex->GetBlockHash();
|
|
|
|
|
peer->m_continuation_block = pindex->GetBlockHash();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|