Skip to content

Commit 610151f

Browse files
committed
validation: change ProcessNewBlock() to take a CBlock reference
Update ProcessNewBlock arguments to newer style.
1 parent d7a6bba commit 610151f

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

src/validation.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3591,14 +3591,14 @@ bool CChainState::AcceptBlock(const std::shared_ptr<const CBlock>& pblock, Block
35913591
return true;
35923592
}
35933593

3594-
bool ChainstateManager::ProcessNewBlock(const CChainParams& chainparams, const std::shared_ptr<const CBlock> pblock, bool fForceProcessing, bool* fNewBlock)
3594+
bool ChainstateManager::ProcessNewBlock(const CChainParams& chainparams, const std::shared_ptr<const CBlock>& block, bool force_processing, bool* new_block)
35953595
{
35963596
AssertLockNotHeld(cs_main);
35973597
assert(std::addressof(::ChainstateActive()) == std::addressof(ActiveChainstate()));
35983598

35993599
{
36003600
CBlockIndex *pindex = nullptr;
3601-
if (fNewBlock) *fNewBlock = false;
3601+
if (new_block) *new_block = false;
36023602
BlockValidationState state;
36033603

36043604
// CheckBlock() does not support multi-threaded block validation because CBlock::fChecked can cause data race.
@@ -3607,21 +3607,21 @@ bool ChainstateManager::ProcessNewBlock(const CChainParams& chainparams, const s
36073607

36083608
// Ensure that CheckBlock() passes before calling AcceptBlock, as
36093609
// belt-and-suspenders.
3610-
bool ret = CheckBlock(*pblock, state, chainparams.GetConsensus());
3610+
bool ret = CheckBlock(*block, state, chainparams.GetConsensus());
36113611
if (ret) {
36123612
// Store to disk
3613-
ret = ActiveChainstate().AcceptBlock(pblock, state, chainparams, &pindex, fForceProcessing, nullptr, fNewBlock);
3613+
ret = ActiveChainstate().AcceptBlock(block, state, chainparams, &pindex, force_processing, nullptr, new_block);
36143614
}
36153615
if (!ret) {
3616-
GetMainSignals().BlockChecked(*pblock, state);
3616+
GetMainSignals().BlockChecked(*block, state);
36173617
return error("%s: AcceptBlock FAILED (%s)", __func__, state.ToString());
36183618
}
36193619
}
36203620

36213621
NotifyHeaderTip(ActiveChainstate());
36223622

36233623
BlockValidationState state; // Only used to report errors, not invalidity - ignore it
3624-
if (!ActiveChainstate().ActivateBestChain(state, chainparams, pblock))
3624+
if (!ActiveChainstate().ActivateBestChain(state, chainparams, block))
36253625
return error("%s: ActivateBestChain failed (%s)", __func__, state.ToString());
36263626

36273627
return true;

src/validation.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -970,22 +970,21 @@ class ChainstateManager
970970
* block is made active. Note that it does not, however, guarantee that the
971971
* specific block passed to it has been checked for validity!
972972
*
973-
* If you want to *possibly* get feedback on whether pblock is valid, you must
973+
* If you want to *possibly* get feedback on whether block is valid, you must
974974
* install a CValidationInterface (see validationinterface.h) - this will have
975975
* its BlockChecked method called whenever *any* block completes validation.
976976
*
977-
* Note that we guarantee that either the proof-of-work is valid on pblock, or
977+
* Note that we guarantee that either the proof-of-work is valid on block, or
978978
* (and possibly also) BlockChecked will have been called.
979979
*
980-
* May not be called in a
981-
* validationinterface callback.
980+
* May not be called in a validationinterface callback.
982981
*
983-
* @param[in] pblock The block we want to process.
984-
* @param[in] fForceProcessing Process this block even if unrequested; used for non-network block sources.
985-
* @param[out] fNewBlock A boolean which is set to indicate if the block was first received via this call
982+
* @param[in] block The block we want to process.
983+
* @param[in] force_processing Process this block even if unrequested; used for non-network block sources.
984+
* @param[out] new_block A boolean which is set to indicate if the block was first received via this call
986985
* @returns If the block was processed, independently of block validity
987986
*/
988-
bool ProcessNewBlock(const CChainParams& chainparams, const std::shared_ptr<const CBlock> pblock, bool fForceProcessing, bool* fNewBlock) LOCKS_EXCLUDED(cs_main);
987+
bool ProcessNewBlock(const CChainParams& chainparams, const std::shared_ptr<const CBlock>& block, bool force_processing, bool* new_block) LOCKS_EXCLUDED(cs_main);
989988

990989
/**
991990
* Process incoming block headers.

0 commit comments

Comments
 (0)