mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
Use exposed ProcessNewBlockHeaders from ProcessMessages
This commit is contained in:
parent
63fd101c52
commit
a8b936df20
21
src/main.cpp
21
src/main.cpp
@ -6019,22 +6019,27 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const CBlockHeader& header, headers) {
|
uint256 hashLastBlock;
|
||||||
CValidationState state;
|
for (const CBlockHeader& header : headers) {
|
||||||
if (pindexLast != NULL && header.hashPrevBlock != pindexLast->GetBlockHash()) {
|
if (!hashLastBlock.IsNull() && header.hashPrevBlock != hashLastBlock) {
|
||||||
Misbehaving(pfrom->GetId(), 20);
|
Misbehaving(pfrom->GetId(), 20);
|
||||||
return error("non-continuous headers sequence");
|
return error("non-continuous headers sequence");
|
||||||
}
|
}
|
||||||
if (!AcceptBlockHeader(header, state, chainparams, &pindexLast)) {
|
hashLastBlock = header.GetHash();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CValidationState state;
|
||||||
|
if (!ProcessNewBlockHeaders(headers, state, chainparams, &pindexLast)) {
|
||||||
int nDoS;
|
int nDoS;
|
||||||
if (state.IsInvalid(nDoS)) {
|
if (state.IsInvalid(nDoS)) {
|
||||||
if (nDoS > 0)
|
if (nDoS > 0) {
|
||||||
|
LOCK(cs_main);
|
||||||
Misbehaving(pfrom->GetId(), nDoS);
|
Misbehaving(pfrom->GetId(), nDoS);
|
||||||
|
}
|
||||||
return error("invalid header received");
|
return error("invalid header received");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
@ -6110,8 +6115,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NotifyHeaderTip();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (strCommand == NetMsgType::BLOCK && !fImporting && !fReindex) // Ignore blocks received while importing
|
else if (strCommand == NetMsgType::BLOCK && !fImporting && !fReindex) // Ignore blocks received while importing
|
||||||
|
Loading…
Reference in New Issue
Block a user