mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
Use a temp pindex to avoid a const_cast in ProcessNewBlockHeaders
This commit is contained in:
parent
15a8fcf993
commit
592d8f0734
@ -3532,11 +3532,13 @@ bool ProcessNewBlockHeaders(const std::vector<CBlockHeader>& headers, CValidatio
|
|||||||
{
|
{
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
for (const CBlockHeader& header : headers) {
|
for (const CBlockHeader& header : headers) {
|
||||||
// cast away the ppindex-returns-const CBlockIndex - we're just assigning it to a CBlockIndex*
|
CBlockIndex *pindex = NULL; // Use a temp pindex instead of ppindex to avoid a const_cast
|
||||||
// that we own and is updated non-const anyway
|
if (!AcceptBlockHeader(header, state, chainparams, &pindex)) {
|
||||||
if (!AcceptBlockHeader(header, state, chainparams, const_cast<CBlockIndex**>(ppindex))) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (ppindex) {
|
||||||
|
*ppindex = pindex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NotifyHeaderTip();
|
NotifyHeaderTip();
|
||||||
|
Loading…
Reference in New Issue
Block a user