diff options
author | Jonas Schnelli <jonas.schnelli@include7.ch> | 2015-09-02 17:03:27 +0200 |
---|---|---|
committer | Jonas Schnelli <dev@jonasschnelli.ch> | 2015-10-26 15:37:30 +0100 |
commit | 872fee3fccc8b33b9af0a401b5f85ac5504b57eb (patch) | |
tree | d868b4a0a6b9f9b55882c324afb362d5a1914e20 /src/main.cpp | |
parent | 867d6c90b85070644c3458e3e7ed168765523361 (diff) |
Introduce -maxuploadtarget
* -maxuploadtarget can be set in MiB
* if <limit> - ( time-left-in-24h-cycle / 600 * MAX_BLOCK_SIZE ) has reach, stop serve blocks older than one week and filtered blocks
* no action if limit has reached, no guarantee that the target will not be surpassed
* add outbound limit informations to rpc getnettotals
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 30df2744a3..26a22ae6fd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3805,6 +3805,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)) |