@@ -3577,6 +3577,7 @@ void static ProcessGetData(CNode* pfrom)
3577
3577
3578
3578
bool static ProcessMessage (CNode* pfrom, string strCommand, CDataStream& vRecv, int64_t nTimeReceived)
3579
3579
{
3580
+ const CChainParams& chainparams = Params ();
3580
3581
RandAddSeedPerfmon ();
3581
3582
LogPrint (" net" , " received: %s (%u bytes) peer=%d\n " , SanitizeString (strCommand), vRecv.size (), pfrom->id );
3582
3583
if (mapArgs.count (" -dropmessagestest" ) && GetRand (atoi (mapArgs[" -dropmessagestest" ])) == 0 )
@@ -3836,7 +3837,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
3836
3837
// not a direct successor.
3837
3838
pfrom->PushMessage (" getheaders" , chainActive.GetLocator (pindexBestHeader), inv.hash );
3838
3839
CNodeState *nodestate = State (pfrom->GetId ());
3839
- if (chainActive.Tip ()->GetBlockTime () > GetAdjustedTime () - Params (). TargetSpacing () * 20 &&
3840
+ if (chainActive.Tip ()->GetBlockTime () > GetAdjustedTime () - chainparams. GetConsensus (). nPowTargetSpacing * 20 &&
3840
3841
nodestate->nBlocksInFlight < MAX_BLOCKS_IN_TRANSIT_PER_PEER) {
3841
3842
vToFetch.push_back (inv);
3842
3843
// Mark block as in flight already, even though the actual "getdata" message only goes out
@@ -4499,6 +4500,7 @@ bool ProcessMessages(CNode* pfrom)
4499
4500
4500
4501
bool SendMessages (CNode* pto, bool fSendTrickle )
4501
4502
{
4503
+ const Consensus::Params& consensusParams = Params ().GetConsensus ();
4502
4504
{
4503
4505
// Don't send anything until we get their version message
4504
4506
if (pto->nVersion == 0 )
@@ -4686,7 +4688,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
4686
4688
// timeout. We compensate for in-flight blocks to prevent killing off peers due to our own downstream link
4687
4689
// being saturated. We only count validated in-flight blocks so peers can't advertize nonexisting block hashes
4688
4690
// to unreasonably increase our timeout.
4689
- if (!pto->fDisconnect && state.vBlocksInFlight .size () > 0 && state.vBlocksInFlight .front ().nTime < nNow - 500000 * Params (). TargetSpacing () * (4 + state.vBlocksInFlight .front ().nValidatedQueuedBefore )) {
4691
+ if (!pto->fDisconnect && state.vBlocksInFlight .size () > 0 && state.vBlocksInFlight .front ().nTime < nNow - 500000 * consensusParams. nPowTargetSpacing * (4 + state.vBlocksInFlight .front ().nValidatedQueuedBefore )) {
4690
4692
LogPrintf (" Timeout downloading block %s from peer=%d, disconnecting\n " , state.vBlocksInFlight .front ().hash .ToString (), pto->id );
4691
4693
pto->fDisconnect = true ;
4692
4694
}
0 commit comments