mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
Restore NODE_NETWORK functionality with trim_headers
This commit is contained in:
parent
1722d4aac1
commit
6367320f70
2 changed files with 8 additions and 12 deletions
|
|
@ -3305,12 +3305,13 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
|||
for (; pindex; pindex = m_chainman.ActiveChain().Next(pindex))
|
||||
{
|
||||
if (pindex->trimmed()) {
|
||||
// For simplicity, if any of the headers they're asking for are trimmed,
|
||||
// just drop the request.
|
||||
LogPrint(BCLog::NET, "%s: ignoring getheaders from peer=%i which would return at least one trimmed header\n", __func__, pfrom.GetId());
|
||||
return;
|
||||
// Header is trimmed, reload from disk before sending
|
||||
CBlockIndex tmpBlockIndexFull;
|
||||
const CBlockIndex* pindexfull = pindex->untrim_to(&tmpBlockIndexFull);
|
||||
vHeaders.push_back(pindexfull->GetBlockHeader());
|
||||
} else {
|
||||
vHeaders.push_back(pindex->GetBlockHeader());
|
||||
}
|
||||
vHeaders.push_back(pindex->GetBlockHeader());
|
||||
if (--nLimit <= 0 || pindex->GetBlockHash() == hashStop)
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue