Browse Source

Improve getheaders (sending) logging

0.10
R E Broadley 10 years ago committed by Pieter Wuille
parent
commit
4c93322923
  1. 5
      src/main.cpp

5
src/main.cpp

@ -3610,6 +3610,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
// later (within the same cs_main lock, though). // later (within the same cs_main lock, though).
MarkBlockAsInFlight(pfrom->GetId(), inv.hash); MarkBlockAsInFlight(pfrom->GetId(), inv.hash);
} }
LogPrint("net", "getheaders (%d) %s to peer=%d\n", pindexBestHeader->nHeight, inv.hash.ToString(), pfrom->id);
} }
} }
@ -3712,7 +3713,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
// we must use CBlocks, as CBlockHeaders won't include the 0x00 nTx count at the end // we must use CBlocks, as CBlockHeaders won't include the 0x00 nTx count at the end
vector<CBlock> vHeaders; vector<CBlock> vHeaders;
int nLimit = MAX_HEADERS_RESULTS; int nLimit = MAX_HEADERS_RESULTS;
LogPrint("net", "getheaders %d to %s\n", (pindex ? pindex->nHeight : -1), hashStop.ToString()); LogPrint("net", "getheaders %d to %s from peer=%d\n", (pindex ? pindex->nHeight : -1), hashStop.ToString(), pfrom->id);
for (; pindex; pindex = chainActive.Next(pindex)) for (; pindex; pindex = chainActive.Next(pindex))
{ {
vHeaders.push_back(pindex->GetBlockHeader()); vHeaders.push_back(pindex->GetBlockHeader());
@ -3878,6 +3879,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
// Headers message had its maximum size; the peer may have more headers. // Headers message had its maximum size; the peer may have more headers.
// TODO: optimize: if pindexLast is an ancestor of chainActive.Tip or pindexBestHeader, continue // TODO: optimize: if pindexLast is an ancestor of chainActive.Tip or pindexBestHeader, continue
// from there instead. // from there instead.
LogPrint("net", "more getheaders (%d) to end to peer=%d (startheight:%d)\n", pindexLast->nHeight, pfrom->id, pfrom->nStartingHeight);
pfrom->PushMessage("getheaders", chainActive.GetLocator(pindexLast), uint256(0)); pfrom->PushMessage("getheaders", chainActive.GetLocator(pindexLast), uint256(0));
} }
} }
@ -4381,6 +4383,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
state.fSyncStarted = true; state.fSyncStarted = true;
nSyncStarted++; nSyncStarted++;
CBlockIndex *pindexStart = pindexBestHeader->pprev ? pindexBestHeader->pprev : pindexBestHeader; CBlockIndex *pindexStart = pindexBestHeader->pprev ? pindexBestHeader->pprev : pindexBestHeader;
LogPrint("net", "initial getheaders (%d) to peer=%d (startheight:%d)\n", pindexStart->nHeight, pto->id, pto->nStartingHeight);
pto->PushMessage("getheaders", chainActive.GetLocator(pindexStart), uint256(0)); pto->PushMessage("getheaders", chainActive.GetLocator(pindexStart), uint256(0));
} }
} }

Loading…
Cancel
Save