Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
// Copyright (c) 2009-2010 Satoshi Nakamoto | // Copyright (c) 2009-2010 Satoshi Nakamoto | ||||
// Copyright (c) 2009-2018 The Bitcoin Core developers | // Copyright (c) 2009-2018 The Bitcoin Core developers | ||||
// Copyright (c) 2017-2020 The Bitcoin developers | // Copyright (c) 2017-2020 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <validation.h> | #include <validation.h> | ||||
#include <arith_uint256.h> | #include <arith_uint256.h> | ||||
#include <avalanche.h> | |||||
#include <blockindexworkcomparator.h> | #include <blockindexworkcomparator.h> | ||||
#include <blockvalidity.h> | #include <blockvalidity.h> | ||||
#include <chainparams.h> | #include <chainparams.h> | ||||
#include <checkpoints.h> | #include <checkpoints.h> | ||||
#include <checkqueue.h> | #include <checkqueue.h> | ||||
#include <config.h> | #include <config.h> | ||||
#include <consensus/activation.h> | #include <consensus/activation.h> | ||||
#include <consensus/consensus.h> | #include <consensus/consensus.h> | ||||
▲ Show 20 Lines • Show All 4,246 Lines • ▼ Show 20 Lines | bool CChainState::AcceptBlock(const Config &config, | ||||
// needed. | // needed. | ||||
if (gArgs.GetBoolArg("-parkdeepreorg", true)) { | if (gArgs.GetBoolArg("-parkdeepreorg", true)) { | ||||
const CBlockIndex *pindexFork = m_chain.FindFork(pindex); | const CBlockIndex *pindexFork = m_chain.FindFork(pindex); | ||||
if (pindexFork && pindexFork->nHeight + 1 < m_chain.Height()) { | if (pindexFork && pindexFork->nHeight + 1 < m_chain.Height()) { | ||||
LogPrintf("Park block %s as it would cause a deep reorg.\n", | LogPrintf("Park block %s as it would cause a deep reorg.\n", | ||||
pindex->GetBlockHash().ToString()); | pindex->GetBlockHash().ToString()); | ||||
pindex->nStatus = pindex->nStatus.withParked(); | pindex->nStatus = pindex->nStatus.withParked(); | ||||
setDirtyBlockIndex.insert(pindex); | setDirtyBlockIndex.insert(pindex); | ||||
if (g_avalanche && | |||||
Fabien: You might want to do it only if avalanche is enabled. Not a huge issue because the message… | |||||
deadalnixAuthorUnsubmitted Done Inline ActionsConsidering how much PoW is needed to create a block, w can live with it :) deadalnix: Considering how much PoW is needed to create a block, w can live with it :) | |||||
FabienUnsubmitted Not Done Inline ActionsNo big deal, it's removed in the next diff anyway. Fabien: No big deal, it's removed in the next diff anyway. | |||||
pindex->nChainWork >= m_chain.Tip()->nChainWork) { | |||||
FabienUnsubmitted Not Done Inline ActionsHow do you plan to make this work with the automatic unparking feature ? As is you may start to poll for a block that will be unparked soon due to enough pow. Maybe avalanche and automatic unpark should be made exclusive ? Fabien: How do you plan to make this work with the automatic unparking feature ? As is you may start to… | |||||
deadalnixAuthorUnsubmitted Done Inline ActionsAvalanche will be unparking down the road. But right now, it's all good, it changes nothing to the automatic unparking behavior. deadalnix: Avalanche will be unparking down the road. But right now, it's all good, it changes nothing to… | |||||
g_avalanche->addBlockToReconcile(pindex); | |||||
} | |||||
} | } | ||||
} | } | ||||
// Header is valid/has work and the merkle tree is good. | // Header is valid/has work and the merkle tree is good. | ||||
// Relay now, but if it does not build on our best tip, let the | // Relay now, but if it does not build on our best tip, let the | ||||
// SendMessages loop relay it. | // SendMessages loop relay it. | ||||
if (!IsInitialBlockDownload() && m_chain.Tip() == pindex->pprev) { | if (!IsInitialBlockDownload() && m_chain.Tip() == pindex->pprev) { | ||||
GetMainSignals().NewPoWValidBlock(pindex, pblock); | GetMainSignals().NewPoWValidBlock(pindex, pblock); | ||||
▲ Show 20 Lines • Show All 1,635 Lines • Show Last 20 Lines |
You might want to do it only if avalanche is enabled. Not a huge issue because the message won't be sent but that would remove the overhead.