aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-11-11 11:02:34 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2016-11-11 11:02:44 +0100
commit7977a1157a3a5130ee41bcea93ff8b9a3896f891 (patch)
tree42902a3491051441b005442f0d8a5d4a9f09b6ad /src
parent46027e8668ecd5755743ab778d1329af84a54653 (diff)
parentdac53b58b555183ccc0d5e64c428528267cd98b3 (diff)
Merge #9058: Fixes for p2p-compactblocks.py test timeouts on travis (#8842)
dac53b5 Modify getblocktxn handler not to drop requests for old blocks (Russell Yanofsky) 55bfddc [qa] Fix stale data bug in test_compactblocks_not_at_tip (Russell Yanofsky) 47e9659 [qa] Fix bug in compactblocks v2 merge (Russell Yanofsky)
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index c6e8a6b791..e868e3c5f9 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -5495,7 +5495,19 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
}
if (it->second->nHeight < chainActive.Height() - MAX_BLOCKTXN_DEPTH) {
+ // If an older block is requested (should never happen in practice,
+ // but can happen in tests) send a block response instead of a
+ // blocktxn response. Sending a full block response instead of a
+ // small blocktxn response is preferable in the case where a peer
+ // might maliciously send lots of getblocktxn requests to trigger
+ // expensive disk reads, because it will require the peer to
+ // actually receive all the data read from disk over the network.
LogPrint("net", "Peer %d sent us a getblocktxn for a block > %i deep", pfrom->id, MAX_BLOCKTXN_DEPTH);
+ CInv vInv;
+ vInv.type = State(pfrom->GetId())->fWantsCmpctWitness ? MSG_WITNESS_BLOCK : MSG_BLOCK;
+ vInv.hash = req.blockhash;
+ pfrom->vRecvGetData.push_back(vInv);
+ ProcessGetData(pfrom, chainparams.GetConsensus(), connman);
return true;
}