aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-10-26 17:46:20 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2015-10-26 17:54:00 +0100
commit7939164d8985a499f710db2c7ce6aa80cc92d819 (patch)
treeb5d423e947f62142d46dcd3b8db09400a5407770 /src/main.cpp
parentdbc5ee821ecdd720b4d8ef9dc8b68d7cd1b87839 (diff)
parent17a073ae0692fe378827e3c4dae01294509e19e9 (diff)
downloadbitcoin-7939164d8985a499f710db2c7ce6aa80cc92d819.tar.xz
Merge pull request #6622
17a073a Add RPC test for -maxuploadtarget (Suhas Daftuar) 872fee3 Introduce -maxuploadtarget (Jonas Schnelli)
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 499f2c3f76..e038fe3663 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3835,6 +3835,16 @@ void static ProcessGetData(CNode* pfrom)
}
}
}
+ // disconnect node in case we have reached the outbound limit for serving historical blocks
+ static const int nOneWeek = 7 * 24 * 60 * 60; // assume > 1 week = historical
+ if (send && CNode::OutboundTargetReached(true) && ( ((pindexBestHeader != NULL) && (pindexBestHeader->GetBlockTime() - mi->second->GetBlockTime() > nOneWeek)) || inv.type == MSG_FILTERED_BLOCK) )
+ {
+ LogPrint("net", "historical block serving limit reached, disconnect peer=%d\n", pfrom->GetId());
+
+ //disconnect node
+ pfrom->fDisconnect = true;
+ send = false;
+ }
// Pruned nodes may have deleted the block, so check whether
// it's available before trying to send.
if (send && (mi->second->nStatus & BLOCK_HAVE_DATA))