Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 4,268 Lines • ▼ Show 20 Lines | bool ChainstateManager::ProcessNewBlock( | ||||
if (!ActiveChainstate().ActivateBestChain(config, state, block)) { | if (!ActiveChainstate().ActivateBestChain(config, state, block)) { | ||||
return error("%s: ActivateBestChain failed (%s)", __func__, | return error("%s: ActivateBestChain failed (%s)", __func__, | ||||
state.ToString()); | state.ToString()); | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
MempoolAcceptResult | |||||
ChainstateManager::ProcessTransaction(const CTransactionRef &tx, | |||||
bool test_accept) { | |||||
CChainState &active_chainstate = ActiveChainstate(); | |||||
if (!active_chainstate.m_mempool) { | |||||
TxValidationState state; | |||||
state.Invalid(TxValidationResult::TX_NO_MEMPOOL, "no-mempool"); | |||||
return MempoolAcceptResult::Failure(state); | |||||
} | |||||
// Use GetConfig() temporarily. It will be removed in a follow-up by | |||||
// making AcceptToMemoryPool take a CChainParams instead of a Config. | |||||
// This avoids passing an extra Config argument to this function that will | |||||
// be removed soon. | |||||
return AcceptToMemoryPool(active_chainstate, ::GetConfig(), | |||||
*active_chainstate.m_mempool, tx, | |||||
/*bypass_limits=*/false, test_accept); | |||||
} | |||||
bool TestBlockValidity(BlockValidationState &state, const CChainParams ¶ms, | bool TestBlockValidity(BlockValidationState &state, const CChainParams ¶ms, | ||||
CChainState &chainstate, const CBlock &block, | CChainState &chainstate, const CBlock &block, | ||||
CBlockIndex *pindexPrev, | CBlockIndex *pindexPrev, | ||||
BlockValidationOptions validationOptions) { | BlockValidationOptions validationOptions) { | ||||
AssertLockHeld(cs_main); | AssertLockHeld(cs_main); | ||||
assert(pindexPrev && pindexPrev == chainstate.m_chain.Tip()); | assert(pindexPrev && pindexPrev == chainstate.m_chain.Tip()); | ||||
CCoinsViewCache viewNew(&chainstate.CoinsTip()); | CCoinsViewCache viewNew(&chainstate.CoinsTip()); | ||||
BlockHash block_hash(block.GetHash()); | BlockHash block_hash(block.GetHash()); | ||||
▲ Show 20 Lines • Show All 1,892 Lines • Show Last 20 Lines |