New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blockindex lookup #371

Merged
merged 1 commit into from Mar 14, 2017
File filter...
Filter file types
Jump to file or symbol
Failed to load files and symbols.
+9 −3
Diff settings

Always

Just for now

Fix potential unwanted assertion

Sending an invalid GET_XTHIN is a serious misbehavior and any node
doing so will be DOS100 banned immediately.

Also sending a GET_XTHIN with an invalid message type will also
cause the sendder to be banned.
  • Loading branch information...
ptschip committed Mar 14, 2017
commit 99d4062c570471d43b36b2ad0d416f36817a1743
Copy path View file
@@ -5925,6 +5925,11 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
{
LOCK(cs_main);
BlockMap::iterator mi = mapBlockIndex.find(inv.hash);
if (mi == mapBlockIndex.end()) {
Misbehaving(pfrom->GetId(), 100);
return false;
}

CBlock block;
const Consensus::Params& consensusParams = Params().GetConsensus();
if (!ReadBlockFromDisk(block, (*mi).second, consensusParams))
Copy path View file
@@ -1013,9 +1013,10 @@ void SendXThinBlock(CBlock &block, CNode* pfrom, const CInv &inv)
}
}
else
{
assert(0); // inv type is not correct
}
{
Misbehaving(pfrom->GetId(), 100);
return;
}
pfrom->blocksSent += 1;
}

ProTip! Use n and p to navigate between commits in a pull request.