Bitcoin Core  21.99.0
P2P Digital Currency
Classes | Enumerations
txrequest.cpp File Reference
#include <txrequest.h>
#include <crypto/siphash.h>
#include <net.h>
#include <primitives/transaction.h>
#include <random.h>
#include <uint256.h>
#include <util/memory.h>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <chrono>
#include <unordered_map>
#include <utility>
#include <assert.h>
Include dependency graph for txrequest.cpp:

Go to the source code of this file.


class  TxRequestTracker::Impl
 Actual implementation for TxRequestTracker's data structure. More...


enum  State : uint8_t
 The various states a (txhash,peer) pair can be in. More...
enum  WaitState

Enumeration Type Documentation

◆ State

enum State : uint8_t

The various states a (txhash,peer) pair can be in.

Note that CANDIDATE is split up into 3 substates (DELAYED, BEST, READY), allowing more efficient implementation. Also note that the sorting order of ByTxHashView relies on the specific order of values in this enum.

Expected behaviour is:

  • When first announced by a peer, the state is CANDIDATE_DELAYED until reqtime is reached.
  • Announcements that have reached their reqtime but not been requested will be either CANDIDATE_READY or CANDIDATE_BEST. Neither of those has an expiration time; they remain in that state until they're requested or no longer needed. CANDIDATE_READY announcements are promoted to CANDIDATE_BEST when they're the best one left.
  • When requested, an announcement will be in state REQUESTED until expiry is reached.
  • If expiry is reached, or the peer replies to the request (either with NOTFOUND or the tx), the state becomes COMPLETED.

Definition at line 39 of file txrequest.cpp.

◆ WaitState

enum WaitState

Definition at line 182 of file txrequest.cpp.