@@ -650,35 +650,10 @@ bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime)
650
650
return true ;
651
651
}
652
652
653
- bool CheckFinalTx (const CTransaction &tx, int flags )
653
+ bool CheckFinalTx (const CTransaction &tx)
654
654
{
655
655
AssertLockHeld (cs_main);
656
-
657
- // By convention a negative value for flags indicates that the
658
- // current network-enforced consensus rules should be used. In
659
- // a future soft-fork scenario that would mean checking which
660
- // rules would be enforced for the next block and setting the
661
- // appropriate flags. At the present time no soft-forks are
662
- // scheduled, so no flags are set.
663
- flags = std::max (flags, 0 );
664
-
665
- // CheckFinalTx() uses chainActive.Height()+1 to evaluate
666
- // nLockTime because when IsFinalTx() is called within
667
- // CBlock::AcceptBlock(), the height of the block *being*
668
- // evaluated is what is used. Thus if we want to know if a
669
- // transaction can be part of the *next* block, we need to call
670
- // IsFinalTx() with one more than chainActive.Height().
671
- const int nBlockHeight = chainActive.Height () + 1 ;
672
-
673
- // Timestamps on the other hand don't get any special treatment,
674
- // because we can't know what timestamp the next block will have,
675
- // and there aren't timestamp applications where it matters.
676
- // However this changes once median past time-locks are enforced:
677
- const int64_t nBlockTime = (flags & LOCKTIME_MEDIAN_TIME_PAST)
678
- ? chainActive.Tip ()->GetMedianTimePast ()
679
- : GetAdjustedTime ();
680
-
681
- return IsFinalTx (tx, nBlockHeight, nBlockTime);
656
+ return IsFinalTx (tx, chainActive.Height () + 1 , GetAdjustedTime ());
682
657
}
683
658
684
659
unsigned int GetLegacySigOpCount (const CTransaction& tx)
@@ -822,7 +797,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
822
797
// Only accept nLockTime-using transactions that can be mined in the next
823
798
// block; we don't want our mempool filled up with transactions that can't
824
799
// be mined yet.
825
- if (!CheckFinalTx (tx, STANDARD_LOCKTIME_VERIFY_FLAGS ))
800
+ if (!CheckFinalTx (tx))
826
801
return state.DoS (0 , false , REJECT_NONSTANDARD, " non-final" );
827
802
828
803
// is it already in the memory pool?
@@ -2748,15 +2723,10 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn
2748
2723
const Consensus::Params& consensusParams = Params ().GetConsensus ();
2749
2724
2750
2725
// Check that all transactions are finalized
2751
- BOOST_FOREACH (const CTransaction& tx, block.vtx ) {
2752
- int nLockTimeFlags = 0 ;
2753
- int64_t nLockTimeCutoff = (nLockTimeFlags & LOCKTIME_MEDIAN_TIME_PAST)
2754
- ? pindexPrev->GetMedianTimePast ()
2755
- : block.GetBlockTime ();
2756
- if (!IsFinalTx (tx, nHeight, nLockTimeCutoff)) {
2726
+ BOOST_FOREACH (const CTransaction& tx, block.vtx )
2727
+ if (!IsFinalTx (tx, nHeight, block.GetBlockTime ())) {
2757
2728
return state.DoS (10 , error (" %s: contains a non-final transaction" , __func__), REJECT_INVALID, " bad-txns-nonfinal" );
2758
2729
}
2759
- }
2760
2730
2761
2731
// Enforce block.nVersion=2 rule that the coinbase starts with serialized block height
2762
2732
// if 750 of the last 1,000 blocks are version 2 or greater (51/100 if testnet):
0 commit comments