[#TxRequestTracker-GetRequestable]
= xref:TxRequestTracker.adoc[TxRequestTracker]::GetRequestable
:relfileprefix: ../
:mrdocs:

Find the txids to request now from peer&period;

== Synopsis

Declared in `&lt;txrequest&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
std::vector&lt;GenTxid&gt;
GetRequestable(
    xref:NodeId-08.adoc[NodeId] peer,
    std::chrono::microseconds now,
    std::vector&lt;std::pair&lt;NodeId, GenTxid&gt;&gt;* expired = nullptr);
----

== Description

It does the following&colon;

* Convert all REQUESTED announcements (for all txhashes&sol;peers) with (expiry &lt;&equals; now) to COMPLETED ones&period; These are returned in expired, if non&hyphen;nullptr&period;
* Requestable announcements are selected&colon; CANDIDATE announcements from the specified peer with (reqtime &lt;&equals; now) for which no existing REQUESTED announcement with the same txhash from a different peer exists, and for which the specified peer is the best choice among all (reqtime &lt;&equals; now) CANDIDATE announcements with the same txhash (subject to preferredness rules, and tiebreaking using a deterministic salted hash of peer and txhash)&period;
* The selected announcements are returned in announcement order (even if multiple were added at the same time, or when the clock went backwards while they were being added)&period; This is done to minimize disruption from dependent transactions being requested out of order&colon; if multiple dependent transactions are announced simultaneously by one peer, and end up being requested from them, the requests will happen in announcement order&period;

== Return Value

The transactions to request now from the peer, in announcement order&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *peer*
| Peer to select requestable transactions for&period;
| *now*
| Current time used to evaluate reqtime and expiry&period;
| *expired*
| If non&hyphen;null, receives the (peer, txhash) pairs whose requests just timed out&period;
|===


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