Prevent fingerprinting, disk-DoS with compact blocks

- Ignore GETBLOCKTXN requests for unknown blocks

Don't disconnect peers, or else we leak information that could be
used for fingerprinting.

- Ignore CMPCTBLOCK messages for pruned blocks

Also ignores CMPCTBLOCK announcements that have too little work.  This is to
prevent disk-exhaustion DoS.

Github-Pull: #8408
Rebased-From: 1de2a46632 1d06e49834
This commit is contained in:
Suhas Daftuar 2016-07-26 16:50:48 -04:00 committed by Wladimir J. van der Laan
parent 8360d5b37d
commit b7e201181b
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
1 changed files with 1 additions and 2 deletions

View File

@ -5344,7 +5344,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
BlockMap::iterator it = mapBlockIndex.find(req.blockhash);
if (it == mapBlockIndex.end() || !(it->second->nStatus & BLOCK_HAVE_DATA)) {
Misbehaving(pfrom->GetId(), 100);
LogPrintf("Peer %d sent us a getblocktxn for a block we don't have", pfrom->id);
return true;
}
@ -5628,8 +5627,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
std::vector<CInv> vInv(1);
vInv[0] = CInv(MSG_BLOCK, cmpctblock.header.GetHash());
pfrom->PushMessage(NetMsgType::GETDATA, vInv);
return true;
}
return true;
}
// If we're not close to tip yet, give up and let parallel block fetch work its magic