diff options
| author | Wladimir J. van der Laan <[email protected]> | 2014-12-23 12:31:35 +0100 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2014-12-23 12:32:47 +0100 |
| commit | 844ace95de246bb76103e4759bd385ceb864a2a5 (patch) | |
| tree | 32b8303d0dc8f32c6b78068b6abdfcc371a2e395 /src/main.cpp | |
| parent | Merge pull request #5481 (diff) | |
| parent | DOS: Respect max per-peer blocks in flight limit (diff) | |
| download | discoin-844ace95de246bb76103e4759bd385ceb864a2a5.tar.xz discoin-844ace95de246bb76103e4759bd385ceb864a2a5.zip | |
Merge pull request #5507
c907704 DOS: Respect max per-peer blocks in flight limit (Adam Weiss)
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index 762a40403..2410230ef 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3597,7 +3597,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, // doing this will result in the received block being rejected as an orphan in case it is // not a direct successor. pfrom->PushMessage("getheaders", chainActive.GetLocator(pindexBestHeader), inv.hash); - if (chainActive.Tip()->GetBlockTime() > GetAdjustedTime() - Params().TargetSpacing() * 20) { + CNodeState *nodestate = State(pfrom->GetId()); + if (chainActive.Tip()->GetBlockTime() > GetAdjustedTime() - Params().TargetSpacing() * 20 && + nodestate->nBlocksInFlight < MAX_BLOCKS_IN_TRANSIT_PER_PEER) { vToFetch.push_back(inv); // Mark block as in flight already, even though the actual "getdata" message only goes out // later (within the same cs_main lock, though). |