[#CalculateSequenceLocks]
= CalculateSequenceLocks
:mrdocs:

Calculates the block height and previous block&apos;s median time past at which the transaction will be considered final in the context of BIP 68&period; For each input that is not sequence locked, the corresponding entries in prevHeights are set to 0 as they do not affect the calculation&period;

== Synopsis

Declared in `&lt;consensus&sol;tx&lowbar;verify&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
std::pair&lt;int, int64&lowbar;t&gt;
CalculateSequenceLocks(
    xref:CTransaction.adoc[CTransaction] const& tx,
    int flags,
    std::vector&lt;int&gt;& prevHeights,
    xref:CBlockIndex.adoc[CBlockIndex] const& block);
----

== Return Value

The minimum height and median time past at which tx becomes final&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *tx*
| The transaction whose sequence locks are computed&period;
| *flags*
| Lock&hyphen;time verification flags controlling BIP 68 enforcement&period;
| *prevHeights*
| Confirmation height of each input, modified in place for non&hyphen;locked inputs&period;
| *block*
| Block relative to which the locks are evaluated&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
