dac53b5Modify 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)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user