Changeset View
Changeset View
Standalone View
Standalone View
src/txrequest.h
Show First 20 Lines • Show All 171 Lines • ▼ Show 20 Lines | public: | ||||
*/ | */ | ||||
void ForgetTxId(const TxId &txid); | void ForgetTxId(const TxId &txid); | ||||
/** | /** | ||||
* Find the txids to request now from peer. | * Find the txids to request now from peer. | ||||
* | * | ||||
* It does the following: | * It does the following: | ||||
* - Convert all REQUESTED announcements (for all txids/peers) with | * - Convert all REQUESTED announcements (for all txids/peers) with | ||||
* (expiry <= now) to COMPLETED ones. | * (expiry <= now) to COMPLETED ones. These are returned in expired, if | ||||
* non-nullptr. | |||||
* - Requestable announcements are selected: CANDIDATE announcements from | * - Requestable announcements are selected: CANDIDATE announcements from | ||||
* the specified peer with (reqtime <= now) for which no existing | * the specified peer with (reqtime <= now) for which no existing | ||||
* REQUESTED announcement with the same txid from a different peer | * REQUESTED announcement with the same txid from a different peer | ||||
* exists, and for which the specified peer is the best choice among all | * exists, and for which the specified peer is the best choice among all | ||||
* (reqtime <= now) CANDIDATE announcements with the same txid (subject | * (reqtime <= now) CANDIDATE announcements with the same txid (subject | ||||
* to preferredness rules, and tiebreaking using a deterministic salted | * to preferredness rules, and tiebreaking using a deterministic salted | ||||
* hash of peer and txid). | * hash of peer and txid). | ||||
* - The selected announcements are returned in announcement order (even | * - The selected announcements are returned in announcement order (even | ||||
* if multiple were added at the same time, or when the clock went | * if multiple were added at the same time, or when the clock went | ||||
* backwards while they were being added). This is done to minimize | * backwards while they were being added). This is done to minimize | ||||
* disruption from dependent transactions being requested out of order: | * disruption from dependent transactions being requested out of order: | ||||
* if multiple dependent transactions are announced simultaneously by one | * if multiple dependent transactions are announced simultaneously by one | ||||
* peer, and end up being requested from them, the requests will happen | * peer, and end up being requested from them, the requests will happen | ||||
* in announcement order. | * in announcement order. | ||||
*/ | */ | ||||
std::vector<TxId> GetRequestable(NodeId peer, | std::vector<TxId> | ||||
std::chrono::microseconds now); | GetRequestable(NodeId peer, std::chrono::microseconds now, | ||||
std::vector<std::pair<NodeId, TxId>> *expired = nullptr); | |||||
/** | /** | ||||
* Marks a transaction as requested, with a specified expiry. | * Marks a transaction as requested, with a specified expiry. | ||||
* | * | ||||
* If no CANDIDATE announcement for the provided peer and txid exists, this | * If no CANDIDATE announcement for the provided peer and txid exists, this | ||||
* call has no effect. Otherwise: | * call has no effect. Otherwise: | ||||
* - That announcement is converted to REQUESTED. | * - That announcement is converted to REQUESTED. | ||||
* - If any other REQUESTED announcement for the same txid already | * - If any other REQUESTED announcement for the same txid already | ||||
▲ Show 20 Lines • Show All 54 Lines • Show Last 20 Lines |