| 320 | static FILE* OpenUndoFile(const CDiskBlockPos &pos, bool fReadOnly = false); |
| 321 | |
| 322 | bool 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 | |
| 354 | bool TestLockPointValidity(const LockPoints* lp) |
| 355 | { |