Skip to content

Commit

Permalink
fix: assertion in Credit Pool validation during connecting blocks
Browse files Browse the repository at this point in the history
It can happen because now order of activation of hardforks v20, mn_rr, dip3
can be changed by using testactivationheight on Regtest and no more
guarantee about this assertions
  • Loading branch information
knst committed Oct 11, 2024
1 parent 7502fc0 commit ec4b04e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/evo/specialtxman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,20 @@ bool CSpecialTxProcessor::CheckCreditPoolDiffForBlock(const CBlock& block, const

try {
if (!DeploymentActiveAt(*pindex, m_consensus_params, Consensus::DEPLOYMENT_DIP0003)) return true;
if (!DeploymentActiveAt(*pindex, m_consensus_params, Consensus::DEPLOYMENT_DIP0008)) return true;
if (!DeploymentActiveAt(*pindex, m_consensus_params, Consensus::DEPLOYMENT_V20)) return true;

auto creditPoolDiff = GetCreditPoolDiffForBlock(m_cpoolman, m_chainman.m_blockman, m_qman, block, pindex->pprev, m_consensus_params, blockSubsidy, state);
if (!creditPoolDiff.has_value()) return false;

// If we get there we have v20 activated and credit pool amount must be included in block CbTx
if (block.vtx.empty()) {
return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "bad-missing-cbtx");
}
const auto& tx = *block.vtx[0];
assert(tx.IsCoinBase());
assert(tx.IsSpecialTxVersion());
assert(tx.nType == TRANSACTION_COINBASE);
if (!tx.IsCoinBase() || !tx.IsSpecialTxVersion() || tx.nType != TRANSACTION_COINBASE) {
return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "bad-cbtx-type");
}

const auto opt_cbTx = GetTxPayload<CCbTx>(tx);
if (!opt_cbTx) {
Expand Down

0 comments on commit ec4b04e

Please sign in to comment.