Skip to content

Commit 921ea89

Browse files
committed
Merge pull request #6195
8273793 Eliminate compiler warning due to unused variable (Suhas Daftuar)
2 parents b679a6b + 8273793 commit 921ea89

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/main.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,9 @@ void UpdatePreferredDownload(CNode* node, CNodeState* state)
264264
}
265265

266266
// Returns time at which to timeout block request (nTime in microseconds)
267-
int64_t GetBlockTimeout(int64_t nTime, int nValidatedQueuedBefore)
267+
int64_t GetBlockTimeout(int64_t nTime, int nValidatedQueuedBefore, const Consensus::Params &consensusParams)
268268
{
269-
return nTime + 500000 * Params().GetConsensus().nPowTargetSpacing * (4 + nValidatedQueuedBefore);
269+
return nTime + 500000 * consensusParams.nPowTargetSpacing * (4 + nValidatedQueuedBefore);
270270
}
271271

272272
void InitializeNode(NodeId nodeid, const CNode *pnode) {
@@ -310,15 +310,15 @@ void MarkBlockAsReceived(const uint256& hash) {
310310
}
311311

312312
// Requires cs_main.
313-
void MarkBlockAsInFlight(NodeId nodeid, const uint256& hash, CBlockIndex *pindex = NULL) {
313+
void MarkBlockAsInFlight(NodeId nodeid, const uint256& hash, const Consensus::Params& consensusParams, CBlockIndex *pindex = NULL) {
314314
CNodeState *state = State(nodeid);
315315
assert(state != NULL);
316316

317317
// Make sure it's not listed somewhere already.
318318
MarkBlockAsReceived(hash);
319319

320320
int64_t nNow = GetTimeMicros();
321-
QueuedBlock newentry = {hash, pindex, nNow, pindex != NULL, GetBlockTimeout(nNow, nQueuedValidatedHeaders)};
321+
QueuedBlock newentry = {hash, pindex, nNow, pindex != NULL, GetBlockTimeout(nNow, nQueuedValidatedHeaders, consensusParams)};
322322
nQueuedValidatedHeaders += newentry.fValidatedHeaders;
323323
list<QueuedBlock>::iterator it = state->vBlocksInFlight.insert(state->vBlocksInFlight.end(), newentry);
324324
state->nBlocksInFlight++;
@@ -4183,7 +4183,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
41834183
vToFetch.push_back(inv);
41844184
// Mark block as in flight already, even though the actual "getdata" message only goes out
41854185
// later (within the same cs_main lock, though).
4186-
MarkBlockAsInFlight(pfrom->GetId(), inv.hash);
4186+
MarkBlockAsInFlight(pfrom->GetId(), inv.hash, chainparams.GetConsensus());
41874187
}
41884188
LogPrint("net", "getheaders (%d) %s to peer=%d\n", pindexBestHeader->nHeight, inv.hash.ToString(), pfrom->id);
41894189
}
@@ -5036,7 +5036,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
50365036
// more quickly than once every 5 minutes, then we'll shorten the download window for this block).
50375037
if (!pto->fDisconnect && state.vBlocksInFlight.size() > 0) {
50385038
QueuedBlock &queuedBlock = state.vBlocksInFlight.front();
5039-
int64_t nTimeoutIfRequestedNow = GetBlockTimeout(nNow, nQueuedValidatedHeaders - state.nBlocksInFlightValidHeaders);
5039+
int64_t nTimeoutIfRequestedNow = GetBlockTimeout(nNow, nQueuedValidatedHeaders - state.nBlocksInFlightValidHeaders, consensusParams);
50405040
if (queuedBlock.nTimeDisconnect > nTimeoutIfRequestedNow) {
50415041
LogPrint("net", "Reducing block download timeout for peer=%d block=%s, orig=%d new=%d\n", pto->id, queuedBlock.hash.ToString(), queuedBlock.nTimeDisconnect, nTimeoutIfRequestedNow);
50425042
queuedBlock.nTimeDisconnect = nTimeoutIfRequestedNow;
@@ -5057,7 +5057,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
50575057
FindNextBlocksToDownload(pto->GetId(), MAX_BLOCKS_IN_TRANSIT_PER_PEER - state.nBlocksInFlight, vToDownload, staller);
50585058
BOOST_FOREACH(CBlockIndex *pindex, vToDownload) {
50595059
vGetData.push_back(CInv(MSG_BLOCK, pindex->GetBlockHash()));
5060-
MarkBlockAsInFlight(pto->GetId(), pindex->GetBlockHash(), pindex);
5060+
MarkBlockAsInFlight(pto->GetId(), pindex->GetBlockHash(), consensusParams, pindex);
50615061
LogPrint("net", "Requesting block %s (%d) peer=%d\n", pindex->GetBlockHash().ToString(),
50625062
pindex->nHeight, pto->id);
50635063
}

0 commit comments

Comments
 (0)