diff options
author | Suhas Daftuar <sdaftuar@gmail.com> | 2019-02-21 13:46:25 -0500 |
---|---|---|
committer | Suhas Daftuar <sdaftuar@gmail.com> | 2019-05-02 15:29:09 -0400 |
commit | 54470e767bab37f9b7089782b1be73d5883bb244 (patch) | |
tree | 93593dd9585f122caa07da630ace4931e1ef5d33 /src/validation.cpp | |
parent | 2120c31521aa51aa1984ee33250b8320506d3a0f (diff) |
Assert validation reasons are contextually correct
Diffstat (limited to 'src/validation.cpp')
-rw-r--r-- | src/validation.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index a9cf425011..c29bff9d30 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -895,6 +895,7 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool state.Invalid(ValidationInvalidReason::TX_WITNESS_MUTATED, false, state.GetRejectCode(), state.GetRejectReason(), state.GetDebugMessage()); } + assert(IsTransactionReason(state.GetReason())); return false; // state filled in by CheckInputs } @@ -1970,6 +1971,7 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl state.Invalid(ValidationInvalidReason::CONSENSUS, false, state.GetRejectCode(), state.GetRejectReason(), state.GetDebugMessage()); } + assert(IsBlockReason(state.GetReason())); return error("%s: Consensus::CheckTxInputs: %s, %s", __func__, tx.GetHash().ToString(), FormatStateMessage(state)); } nFees += txfee; @@ -3507,6 +3509,7 @@ bool CChainState::AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CVali if (!CheckBlock(block, state, chainparams.GetConsensus()) || !ContextualCheckBlock(block, state, chainparams.GetConsensus(), pindex->pprev)) { + assert(IsBlockReason(state.GetReason())); if (state.IsInvalid() && state.GetReason() != ValidationInvalidReason::BLOCK_MUTATED) { pindex->nStatus |= BLOCK_FAILED_VALID; setDirtyBlockIndex.insert(pindex); |