Find the txids to request now from peer.
Synopsis
Declared in <txrequest.h>
std::vector<GenTxid>
GetRequestable(
NodeId peer,
std::chrono::microseconds now,
std::vector<std::pair<NodeId, GenTxid>>* expired = nullptr);
Description
It does the following:
-
Convert all REQUESTED announcements (for all txhashes/peers) with (expiry <= now) to COMPLETED ones. These are returned in expired, if non‐nullptr.
-
Requestable announcements are selected: CANDIDATE announcements from the specified peer with (reqtime <= 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 <= now) CANDIDATE announcements with the same txhash (subject to preferredness rules, and tiebreaking using a deterministic salted hash of peer and txhash).
-
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). This is done to minimize disruption from dependent transactions being requested out of order: if multiple dependent transactions are announced simultaneously by one peer, and end up being requested from them, the requests will happen in announcement order.
Return Value
The transactions to request now from the peer, in announcement order.
Parameters
Name |
Description |
peer |
Peer to select requestable transactions for. |
now |
Current time used to evaluate reqtime and expiry. |
expired |
If non‐null, receives the (peer, txhash) pairs whose requests just timed out. |
Created with MrDocs