refactor: Move calculation logic out from CheckSequenceLocksAtTip()

This commit is contained in:
Hennadii Stepanov
2023-01-31 13:26:54 +00:00
parent 3bc434f459
commit 75db62ba4c
3 changed files with 27 additions and 90 deletions

View File

@@ -271,24 +271,13 @@ std::optional<LockPoints> CalculateLockPointsAtTip(
* Check if transaction will be BIP68 final in the next block to be created on top of tip.
* @param[in] tip Chain tip to check tx sequence locks against. For example,
* the tip of the current active chain.
* @param[in] coins_view Any CCoinsView that provides access to the relevant coins for
* checking sequence locks. For example, it can be a CCoinsViewCache
* that isn't connected to anything but contains all the relevant
* coins, or a CCoinsViewMemPool that is connected to the
* mempool and chainstate UTXO set. In the latter case, the caller is
* responsible for holding the appropriate locks to ensure that
* calls to GetCoin() return correct coins.
* @param[in] lock_points LockPoints containing the height and time at which this
* transaction is final.
* Simulates calling SequenceLocks() with data from the tip passed in.
* Optionally stores in LockPoints the resulting height and time calculated and the hash
* of the block needed for calculation or skips the calculation and uses the LockPoints
* passed in for evaluation.
* The LockPoints should not be considered valid if CheckSequenceLocksAtTip returns false.
*/
bool CheckSequenceLocksAtTip(CBlockIndex* tip,
const CCoinsView& coins_view,
const CTransaction& tx,
LockPoints* lp = nullptr,
bool useExistingLockPoints = false);
const LockPoints& lock_points);
/**
* Closure representing one script verification