MCPcopy Create free account
hub / github.com/LUX-Core/lux / CheckFinalTx

Function CheckFinalTx

src/main.cpp:927–955  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

925}
926
927bool CheckFinalTx(const CTransaction& tx, int flags)
928{
929 AssertLockHeld(cs_main);
930
931 // By convention a negative value for flags indicates that the
932 // current network-enforced consensus rules should be used. In
933 // a future soft-fork scenario that would mean checking which
934 // rules would be enforced for the next block and setting the
935 // appropriate flags. At the present time no soft-forks are
936 // scheduled, so no flags are set.
937 flags = std::max(flags, 0);
938
939 // CheckFinalTx() uses chainActive.Height()+1 to evaluate
940 // nLockTime because when IsFinalTx() is called within
941 // CBlock::AcceptBlock(), the height of the block *being*
942 // evaluated is what is used. Thus if we want to know if a
943 // transaction can be part of the *next* block, we need to call
944 // IsFinalTx() with one more than chainActive.Height().
945 const int nBlockHeight = chainActive.Height() + 1;
946
947 // BIP113 will require that time-locked transactions have nLockTime set to
948 // less than the median time of the previous block they're contained in.
949 // When the next block is created its previous block will be the current
950 // chain tip, so we use that to calculate the median time passed to
951 // IsFinalTx() if LOCKTIME_MEDIAN_TIME_PAST is set.
952 const int64_t nBlockTime = (flags & LOCKTIME_MEDIAN_TIME_PAST) ? chainActive.Tip()->GetMedianTimePast() : GetAdjustedTime();
953
954 return IsFinalTx(tx, nBlockHeight, nBlockTime);
955}
956
957CAmount GetMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowFree)
958{

Callers 3

removeForReorgMethod · 0.85
AvailableCoinsMethod · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85

Calls 6

maxFunction · 0.85
GetAdjustedTimeFunction · 0.85
IsFinalTxFunction · 0.85
HeightMethod · 0.80
GetMedianTimePastMethod · 0.80
TipMethod · 0.80

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.68