Skip to content

Commit

Permalink
Remove now unneeded fAccepted flag from ProcessNewBlock.
Browse files Browse the repository at this point in the history
Plus pass pblock as const reference.
  • Loading branch information
furszy committed Jul 21, 2021
1 parent 0d4ba29 commit 4f62c04
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/net_processing.cpp
Expand Up @@ -1699,8 +1699,7 @@ bool static ProcessMessage(CNode* pfrom, std::string strCommand, CDataStream& vR
MarkBlockAsReceived(hashBlock);
mapBlockSource.emplace(hashBlock, pfrom->GetId());
}
bool fAccepted = true;
ProcessNewBlock(pblock, nullptr, &fAccepted);
ProcessNewBlock(pblock, nullptr);
//disconnect this node if its old protocol version
pfrom->DisconnectOldProtocol(pfrom->nVersion, ActiveProtocol(), strCommand);
} else {
Expand Down
3 changes: 1 addition & 2 deletions src/validation.cpp
Expand Up @@ -3307,7 +3307,7 @@ static bool AcceptBlock(const CBlock& block, CValidationState& state, CBlockInde
return true;
}

bool ProcessNewBlock(const std::shared_ptr<const CBlock> pblock, const FlatFilePos* dbp, bool* fAccepted)
bool ProcessNewBlock(const std::shared_ptr<const CBlock>& pblock, const FlatFilePos* dbp)
{
AssertLockNotHeld(cs_main);

Expand All @@ -3327,7 +3327,6 @@ bool ProcessNewBlock(const std::shared_ptr<const CBlock> pblock, const FlatFileP
// Store to disk
CBlockIndex* pindex = nullptr;
bool ret = AcceptBlock(*pblock, state, &pindex, dbp);
if (fAccepted) *fAccepted = ret;
CheckBlockIndex();
if (!ret) {
GetMainSignals().BlockChecked(*pblock, state);
Expand Down
3 changes: 1 addition & 2 deletions src/validation.h
Expand Up @@ -167,10 +167,9 @@ extern CBlockIndex* pindexBestHeader;
*
* @param[in] pblock The block we want to process.
* @param[out] dbp The already known disk position of pblock, or nullptr if not yet stored.
* @param[out] fAccepted Whether the block is accepted or not
* @return True if state.IsValid()
*/
bool ProcessNewBlock(const std::shared_ptr<const CBlock> pblock, const FlatFilePos* dbp, bool* fAccepted = nullptr);
bool ProcessNewBlock(const std::shared_ptr<const CBlock>& pblock, const FlatFilePos* dbp);

/** Open a block file (blk?????.dat) */
FILE* OpenBlockFile(const FlatFilePos& pos, bool fReadOnly = false);
Expand Down

0 comments on commit 4f62c04

Please sign in to comment.