@@ -205,7 +205,7 @@ class CChainState {
205
205
206
206
void InvalidBlockFound (CBlockIndex *pindex, const CValidationState &state);
207
207
CBlockIndex* FindMostWorkChain ();
208
- bool ReceivedBlockTransactions (const CBlock & block, CValidationState& state, CBlockIndex * pindexNew, const CDiskBlockPos& pos, const Consensus::Params& consensusParams);
208
+ void ReceivedBlockTransactions (const CBlock& block, CBlockIndex* pindexNew, const CDiskBlockPos& pos, const Consensus::Params& consensusParams);
209
209
210
210
211
211
bool RollforwardBlock (const CBlockIndex* pindex, CCoinsViewCache& inputs, const CChainParams& params);
@@ -2953,7 +2953,7 @@ CBlockIndex* CChainState::AddToBlockIndex(const CBlockHeader& block)
2953
2953
}
2954
2954
2955
2955
/* * Mark a block as having its data received and checked (up to BLOCK_VALID_TRANSACTIONS). */
2956
- bool CChainState::ReceivedBlockTransactions (const CBlock & block, CValidationState& state, CBlockIndex * pindexNew, const CDiskBlockPos& pos, const Consensus::Params& consensusParams)
2956
+ void CChainState::ReceivedBlockTransactions (const CBlock& block, CBlockIndex* pindexNew, const CDiskBlockPos& pos, const Consensus::Params& consensusParams)
2957
2957
{
2958
2958
pindexNew->nTx = block.vtx .size ();
2959
2959
pindexNew->nChainTx = 0 ;
@@ -2997,8 +2997,6 @@ bool CChainState::ReceivedBlockTransactions(const CBlock &block, CValidationStat
2997
2997
mapBlocksUnlinked.insert (std::make_pair (pindexNew->pprev , pindexNew));
2998
2998
}
2999
2999
}
3000
-
3001
- return true ;
3002
3000
}
3003
3001
3004
3002
static bool FindBlockPos (CDiskBlockPos &pos, unsigned int nAddSize, unsigned int nHeight, uint64_t nTime, bool fKnown = false )
@@ -3533,8 +3531,7 @@ bool CChainState::AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CVali
3533
3531
state.Error (strprintf (" %s: Failed to find position to write new block to disk" , __func__));
3534
3532
return false ;
3535
3533
}
3536
- if (!ReceivedBlockTransactions (block, state, pindex, blockPos, chainparams.GetConsensus ()))
3537
- return error (" AcceptBlock(): ReceivedBlockTransactions failed" );
3534
+ ReceivedBlockTransactions (block, pindex, blockPos, chainparams.GetConsensus ());
3538
3535
} catch (const std::runtime_error& e) {
3539
3536
return AbortNode (state, std::string (" System error: " ) + e.what ());
3540
3537
}
@@ -4343,9 +4340,7 @@ bool CChainState::LoadGenesisBlock(const CChainParams& chainparams)
4343
4340
if (blockPos.IsNull ())
4344
4341
return error (" %s: writing genesis block to disk failed" , __func__);
4345
4342
CBlockIndex *pindex = AddToBlockIndex (block);
4346
- CValidationState state;
4347
- if (!ReceivedBlockTransactions (block, state, pindex, blockPos, chainparams.GetConsensus ()))
4348
- return error (" %s: genesis block not accepted (%s)" , __func__, FormatStateMessage (state));
4343
+ ReceivedBlockTransactions (block, pindex, blockPos, chainparams.GetConsensus ());
4349
4344
} catch (const std::runtime_error& e) {
4350
4345
return error (" %s: failed to write genesis block: %s" , __func__, e.what ());
4351
4346
}
0 commit comments