diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2023-01-31 13:26:45 +0000 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2023-01-31 13:26:45 +0000 |
commit | 3bc434f4590758db673e1bd4ebf1906ea632f593 (patch) | |
tree | ef62a514e04297dccf77700d2a14963bb6f41cde /src/validation.h | |
parent | 78aee0fe2ca72e7bc0f36e7479574ebc1f6a9bee (diff) | |
download | bitcoin-3bc434f4590758db673e1bd4ebf1906ea632f593.tar.xz |
refactor: Add `CalculateLockPointsAtTip()` function
Diffstat (limited to 'src/validation.h')
-rw-r--r-- | src/validation.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/validation.h b/src/validation.h index b8151dc1fc..36c59b41df 100644 --- a/src/validation.h +++ b/src/validation.h @@ -245,6 +245,29 @@ PackageMempoolAcceptResult ProcessNewPackage(Chainstate& active_chainstate, CTxM bool CheckFinalTxAtTip(const CBlockIndex& active_chain_tip, const CTransaction& tx) EXCLUSIVE_LOCKS_REQUIRED(::cs_main); /** + * Calculate LockPoints required to check if transaction will be BIP68 final in the next block + * to be created on top of tip. + * + * @param[in] tip Chain tip for which tx sequence locks are calculated. 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] tx The transaction being evaluated. + * + * @returns The resulting height and time calculated and the hash of the block needed for + * calculation, or std::nullopt if there is an error. + */ +std::optional<LockPoints> CalculateLockPointsAtTip( + CBlockIndex* tip, + const CCoinsView& coins_view, + const CTransaction& tx); + +/** * 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. |