Skip to content

Commit eb3b20e

Browse files
committed
[validation] Remove unused pindex outparam from AcceptBlock()
1 parent a8dd24b commit eb3b20e

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/validation.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3711,15 +3711,15 @@ static FlatFilePos SaveBlockToDisk(const CBlock& block, int nHeight, const CChai
37113711
}
37123712

37133713
/** Store block on disk. If dbp is non-nullptr, the file is known to already reside on disk */
3714-
bool CChainState::AcceptBlock(const std::shared_ptr<const CBlock>& pblock, BlockValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex, bool fRequested, const FlatFilePos* dbp, bool* fNewBlock)
3714+
bool CChainState::AcceptBlock(const std::shared_ptr<const CBlock>& pblock, BlockValidationState& state, const CChainParams& chainparams, bool fRequested, const FlatFilePos* dbp, bool* fNewBlock)
37153715
{
37163716
const CBlock& block = *pblock;
37173717

37183718
if (fNewBlock) *fNewBlock = false;
37193719
AssertLockHeld(cs_main);
37203720

37213721
CBlockIndex *pindexDummy = nullptr;
3722-
CBlockIndex *&pindex = ppindex ? *ppindex : pindexDummy;
3722+
CBlockIndex *&pindex = pindexDummy;
37233723

37243724
bool accepted_header = m_blockman.AcceptBlockHeader(block, state, chainparams, &pindex);
37253725
CheckBlockIndex(chainparams.GetConsensus());
@@ -3810,13 +3810,12 @@ bool ProcessNewBlock(const CChainParams& chainparams, const std::shared_ptr<cons
38103810
AssertLockNotHeld(cs_main);
38113811

38123812
{
3813-
CBlockIndex *pindex = nullptr;
38143813
if (fNewBlock) *fNewBlock = false;
38153814
BlockValidationState state;
38163815

38173816
LOCK(cs_main);
38183817

3819-
if (!ChainstateActive().AcceptBlock(pblock, state, chainparams, &pindex, fForceProcessing, nullptr, fNewBlock)) {
3818+
if (!ChainstateActive().AcceptBlock(pblock, state, chainparams, fForceProcessing, nullptr, fNewBlock)) {
38203819
GetMainSignals().BlockChecked(*pblock, state);
38213820
return error("%s: AcceptBlock FAILED (%s)", __func__, state.ToString());
38223821
}
@@ -4703,7 +4702,7 @@ bool LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, FlatFi
47034702
CBlockIndex* pindex = LookupBlockIndex(hash);
47044703
if (!pindex || (pindex->nStatus & BLOCK_HAVE_DATA) == 0) {
47054704
BlockValidationState state;
4706-
if (::ChainstateActive().AcceptBlock(pblock, state, chainparams, nullptr, true, dbp, nullptr)) {
4705+
if (::ChainstateActive().AcceptBlock(pblock, state, chainparams, true, dbp, nullptr)) {
47074706
nLoaded++;
47084707
}
47094708
if (state.IsError()) {
@@ -4740,7 +4739,7 @@ bool LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, FlatFi
47404739
head.ToString());
47414740
LOCK(cs_main);
47424741
BlockValidationState dummy;
4743-
if (::ChainstateActive().AcceptBlock(pblockrecursive, dummy, chainparams, nullptr, true, &it->second, nullptr))
4742+
if (::ChainstateActive().AcceptBlock(pblockrecursive, dummy, chainparams, true, &it->second, nullptr))
47444743
{
47454744
nLoaded++;
47464745
queue.push_back(pblockrecursive->GetHash());

src/validation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ class CChainState {
693693
const CChainParams& chainparams,
694694
std::shared_ptr<const CBlock> pblock) LOCKS_EXCLUDED(cs_main);
695695

696-
bool AcceptBlock(const std::shared_ptr<const CBlock>& pblock, BlockValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex, bool fRequested, const FlatFilePos* dbp, bool* fNewBlock) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
696+
bool AcceptBlock(const std::shared_ptr<const CBlock>& pblock, BlockValidationState& state, const CChainParams& chainparams, bool fRequested, const FlatFilePos* dbp, bool* fNewBlock) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
697697

698698
// Block (dis)connection on a given view:
699699
DisconnectResult DisconnectBlock(const CBlock& block, const CBlockIndex* pindex, CCoinsViewCache& view);

0 commit comments

Comments
 (0)