MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / CheckFinalTx

Function CheckFinalTx

src/validation.cpp:322–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320static FILE* OpenUndoFile(const CDiskBlockPos &pos, bool fReadOnly = false);
321
322bool CheckFinalTx(const CTransaction &tx, int flags)
323{
324 AssertLockHeld(cs_main);
325
326 // By convention a negative value for flags indicates that the
327 // current network-enforced consensus rules should be used. In
328 // a future soft-fork scenario that would mean checking which
329 // rules would be enforced for the next block and setting the
330 // appropriate flags. At the present time no soft-forks are
331 // scheduled, so no flags are set.
332 flags = std::max(flags, 0);
333
334 // CheckFinalTx() uses chainActive.Height()+1 to evaluate
335 // nLockTime because when IsFinalTx() is called within
336 // CBlock::AcceptBlock(), the height of the block *being*
337 // evaluated is what is used. Thus if we want to know if a
338 // transaction can be part of the *next* block, we need to call
339 // IsFinalTx() with one more than chainActive.Height().
340 const int nBlockHeight = chainActive.Height() + 1;
341
342 // BIP113 requires that time-locked transactions have nLockTime set to
343 // less than the median time of the previous block they're contained in.
344 // When the next block is created its previous block will be the current
345 // chain tip, so we use that to calculate the median time passed to
346 // IsFinalTx() if LOCKTIME_MEDIAN_TIME_PAST is set.
347 const int64_t nBlockTime = (flags & LOCKTIME_MEDIAN_TIME_PAST)
348 ? chainActive.Tip()->GetMedianTimePast()
349 : GetAdjustedTime();
350
351 return IsFinalTx(tx, nBlockHeight, nBlockTime);
352}
353
354bool TestLockPointValidity(const LockPoints* lp)
355{

Callers 10

removeForReorgMethod · 0.85
AcceptToMemoryPoolWorkerFunction · 0.85
getreceivedbyaddressFunction · 0.85
getreceivedbylabelFunction · 0.85
ListReceivedFunction · 0.85
IsTrustedMethod · 0.85
GetLegacyBalanceMethod · 0.85
AvailableCoinsMethod · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
MakeWalletTxStatusFunction · 0.85

Calls 6

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

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.68