mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 15:04:44 +01:00
Make ReceivedBlockTransactions return void
This commit is contained in:
parent
f8bcef38fb
commit
fafa270328
1 changed files with 4 additions and 9 deletions
|
@ -205,7 +205,7 @@ private:
|
||||||
|
|
||||||
void InvalidBlockFound(CBlockIndex *pindex, const CValidationState &state);
|
void InvalidBlockFound(CBlockIndex *pindex, const CValidationState &state);
|
||||||
CBlockIndex* FindMostWorkChain();
|
CBlockIndex* FindMostWorkChain();
|
||||||
bool ReceivedBlockTransactions(const CBlock &block, CValidationState& state, CBlockIndex *pindexNew, const CDiskBlockPos& pos, const Consensus::Params& consensusParams);
|
void ReceivedBlockTransactions(const CBlock& block, CBlockIndex* pindexNew, const CDiskBlockPos& pos, const Consensus::Params& consensusParams);
|
||||||
|
|
||||||
|
|
||||||
bool RollforwardBlock(const CBlockIndex* pindex, CCoinsViewCache& inputs, const CChainParams& params);
|
bool RollforwardBlock(const CBlockIndex* pindex, CCoinsViewCache& inputs, const CChainParams& params);
|
||||||
|
@ -2956,7 +2956,7 @@ CBlockIndex* CChainState::AddToBlockIndex(const CBlockHeader& block)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Mark a block as having its data received and checked (up to BLOCK_VALID_TRANSACTIONS). */
|
/** Mark a block as having its data received and checked (up to BLOCK_VALID_TRANSACTIONS). */
|
||||||
bool CChainState::ReceivedBlockTransactions(const CBlock &block, CValidationState& state, CBlockIndex *pindexNew, const CDiskBlockPos& pos, const Consensus::Params& consensusParams)
|
void CChainState::ReceivedBlockTransactions(const CBlock& block, CBlockIndex* pindexNew, const CDiskBlockPos& pos, const Consensus::Params& consensusParams)
|
||||||
{
|
{
|
||||||
pindexNew->nTx = block.vtx.size();
|
pindexNew->nTx = block.vtx.size();
|
||||||
pindexNew->nChainTx = 0;
|
pindexNew->nChainTx = 0;
|
||||||
|
@ -3000,8 +3000,6 @@ bool CChainState::ReceivedBlockTransactions(const CBlock &block, CValidationStat
|
||||||
mapBlocksUnlinked.insert(std::make_pair(pindexNew->pprev, pindexNew));
|
mapBlocksUnlinked.insert(std::make_pair(pindexNew->pprev, pindexNew));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool FindBlockPos(CDiskBlockPos &pos, unsigned int nAddSize, unsigned int nHeight, uint64_t nTime, bool fKnown = false)
|
static bool FindBlockPos(CDiskBlockPos &pos, unsigned int nAddSize, unsigned int nHeight, uint64_t nTime, bool fKnown = false)
|
||||||
|
@ -3536,8 +3534,7 @@ bool CChainState::AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CVali
|
||||||
state.Error(strprintf("%s: Failed to find position to write new block to disk", __func__));
|
state.Error(strprintf("%s: Failed to find position to write new block to disk", __func__));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!ReceivedBlockTransactions(block, state, pindex, blockPos, chainparams.GetConsensus()))
|
ReceivedBlockTransactions(block, pindex, blockPos, chainparams.GetConsensus());
|
||||||
return error("AcceptBlock(): ReceivedBlockTransactions failed");
|
|
||||||
} catch (const std::runtime_error& e) {
|
} catch (const std::runtime_error& e) {
|
||||||
return AbortNode(state, std::string("System error: ") + e.what());
|
return AbortNode(state, std::string("System error: ") + e.what());
|
||||||
}
|
}
|
||||||
|
@ -4346,9 +4343,7 @@ bool CChainState::LoadGenesisBlock(const CChainParams& chainparams)
|
||||||
if (blockPos.IsNull())
|
if (blockPos.IsNull())
|
||||||
return error("%s: writing genesis block to disk failed", __func__);
|
return error("%s: writing genesis block to disk failed", __func__);
|
||||||
CBlockIndex *pindex = AddToBlockIndex(block);
|
CBlockIndex *pindex = AddToBlockIndex(block);
|
||||||
CValidationState state;
|
ReceivedBlockTransactions(block, pindex, blockPos, chainparams.GetConsensus());
|
||||||
if (!ReceivedBlockTransactions(block, state, pindex, blockPos, chainparams.GetConsensus()))
|
|
||||||
return error("%s: genesis block not accepted (%s)", __func__, FormatStateMessage(state));
|
|
||||||
} catch (const std::runtime_error& e) {
|
} catch (const std::runtime_error& e) {
|
||||||
return error("%s: failed to write genesis block: %s", __func__, e.what());
|
return error("%s: failed to write genesis block: %s", __func__, e.what());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue