@@ -596,7 +596,7 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
596
596
// block; we don't want our mempool filled up with transactions that can't
597
597
// be mined yet.
598
598
if (!CheckFinalTx (tx, STANDARD_LOCKTIME_VERIFY_FLAGS))
599
- return state.Invalid (ValidationInvalidReason::TX_NOT_STANDARD , false , REJECT_NONSTANDARD, " non-final" );
599
+ return state.Invalid (ValidationInvalidReason::TX_PREMATURE_SPEND , false , REJECT_NONSTANDARD, " non-final" );
600
600
601
601
// is it already in the memory pool?
602
602
if (pool.exists (hash)) {
@@ -685,7 +685,7 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
685
685
// Must keep pool.cs for this unless we change CheckSequenceLocks to take a
686
686
// CoinsViewCache instead of create its own
687
687
if (!CheckSequenceLocks (pool, tx, STANDARD_LOCKTIME_VERIFY_FLAGS, &lp))
688
- return state.Invalid (ValidationInvalidReason::TX_NOT_STANDARD , false , REJECT_NONSTANDARD, " non-BIP68-final" );
688
+ return state.Invalid (ValidationInvalidReason::TX_PREMATURE_SPEND , false , REJECT_NONSTANDARD, " non-BIP68-final" );
689
689
690
690
CAmount nFees = 0 ;
691
691
if (!Consensus::CheckTxInputs (tx, state, view, GetSpendHeight (view), nFees)) {
@@ -1965,13 +1965,14 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl
1965
1965
{
1966
1966
CAmount txfee = 0 ;
1967
1967
if (!Consensus::CheckTxInputs (tx, state, view, pindex->nHeight , txfee)) {
1968
- if (state.GetReason () == ValidationInvalidReason::TX_MISSING_INPUTS) {
1969
- // CheckTxInputs may return MISSING_INPUTS but we can't return that, as
1970
- // it's not defined for a block, so we reset the reason flag to CONSENSUS here.
1968
+ if (!IsBlockReason (state.GetReason ())) {
1969
+ // CheckTxInputs may return MISSING_INPUTS or
1970
+ // PREMATURE_SPEND but we can't return that, as it's not
1971
+ // defined for a block, so we reset the reason flag to
1972
+ // CONSENSUS here.
1971
1973
state.Invalid (ValidationInvalidReason::CONSENSUS, false ,
1972
1974
state.GetRejectCode (), state.GetRejectReason (), state.GetDebugMessage ());
1973
1975
}
1974
- assert (IsBlockReason (state.GetReason ()));
1975
1976
return error (" %s: Consensus::CheckTxInputs: %s, %s" , __func__, tx.GetHash ().ToString (), FormatStateMessage (state));
1976
1977
}
1977
1978
nFees += txfee;
0 commit comments