Module tx_fetcher

Source
Expand description

Constants used by TransactionFetcher.

Constants§

AVERAGE_BYTE_SIZE_TX_ENCODED
Average byte size of an encoded transaction.
DEFAULT_BUDGET_FIND_IDLE_FALLBACK_PEER
Default budget for finding an idle fallback peer for any hash pending fetch, when said search is budget constrained.
DEFAULT_BUDGET_FIND_INTERSECTION_ANNOUNCED_BY_PEER_AND_PENDING_FETCH
Default budget for finding hashes in the intersection of transactions announced by a peer and in the cache of hashes pending fetch, when said search is budget constrained.
DEFAULT_DIVISOR_MAX_COUNT_INFLIGHT_REQUESTS_ON_FIND_IDLE_PEER
Default divisor of the max inflight request when calculating search breadth of the search for any idle peer to which to send a request filled with hashes pending fetch. The max inflight requests is configured in TransactionFetcherInfo.
DEFAULT_DIVISOR_MAX_COUNT_INFLIGHT_REQUESTS_ON_FIND_INTERSECTION
Default divisor of the max inflight request when calculating search breadth of the search for the intersection of hashes announced by a peer and hashes pending fetch. The max inflight requests is configured in TransactionFetcherInfo.
DEFAULT_DIVISOR_MAX_COUNT_PENDING_POOL_IMPORTS_ON_FIND_IDLE_PEER
search for any idle peer to which to send a request filled with hashes pending fetch. The max pending pool imports is configured in PendingPoolImportsInfo.
DEFAULT_DIVISOR_MAX_COUNT_PENDING_POOL_IMPORTS_ON_FIND_INTERSECTION
Default divisor to the max pending pool imports when calculating search breadth of the search for any idle peer to which to send a request filled with hashes pending fetch. The max pending pool imports is configured in PendingPoolImportsInfo.
DEFAULT_MARGINAL_COUNT_FALLBACK_PEERS
Default marginal on fallback peers. This is the case, since a transaction is only requested once from each individual peer.
DEFAULT_MARGINAL_COUNT_HASHES_GET_POOLED_TRANSACTIONS_REQUEST
Marginal on the number of hashes to preallocate memory for in a GetPooledTransactions request, when packed according to the Eth68 protocol version. To make sure enough memory is preallocated in most cases, it’s sensible to use a margin. This, since the capacity is calculated based on median value MEDIAN_BYTE_SIZE_SMALL_LEGACY_TX_ENCODED. There may otherwise be a noteworthy number of cases where just 1 or 2 bytes too little memory is preallocated.
DEFAULT_MAX_CAPACITY_CACHE_INFLIGHT_AND_PENDING_FETCH
Default max size for cache of inflight and pending transactions fetch.
DEFAULT_MAX_CAPACITY_CACHE_PENDING_FETCH
Default limit for number of transactions waiting for an idle peer to be fetched from.
DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS
Default maximum concurrent GetPooledTransactions requests.
DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS_PER_PEER
Default maximum number of concurrent GetPooledTransactionss to allow per peer. This number reflects concurrent requests for different hashes.
DEFAULT_MAX_COUNT_FALLBACK_PEERS
Default number of alternative peers to keep track of for each transaction pending fetch. At most DEFAULT_MAX_RETRIES, which defaults to 2 peers, can ever be needed per peer.
DEFAULT_MAX_COUNT_INFLIGHT_REQUESTS_ON_FETCH_PENDING_HASHES
Default max inflight request when fetching pending hashes.
DEFAULT_MAX_COUNT_PENDING_FETCH
Default maximum number of hashes pending fetch to tolerate at any time.
DEFAULT_MAX_RETRIES
Default maximum request retires per TxHash. Note, this is reset should the TxHash re-appear in an announcement after it has been evicted from the hashes pending fetch cache, i.e. the counter is restarted. If this happens, it is likely a very popular transaction, that should and can indeed be fetched hence this behaviour is favourable.
DEFAULT_SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESPONSE_ON_FETCH_PENDING_HASHES
Default soft limit for a PooledTransactions response when it’s used as expected response in calibrating the filling of a GetPooledTransactions request, when the request is filled from hashes pending fetch.
DEFAULT_SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESP_ON_PACK_GET_POOLED_TRANSACTIONS_REQ
Default soft limit for the byte size of a PooledTransactions response on assembling a GetPooledTransactions request. This defaults to less than the SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESPONSE, at 2 MiB, used when assembling a PooledTransactions response.
DEFAULT_SOFT_LIMIT_COUNT_HASHES_IN_GET_POOLED_TRANSACTIONS_REQUEST_ON_FETCH_PENDING_HASHES
Default soft limit for the number of hashes in a GetPooledTransactions request, when it is filled from hashes pending fetch.
MEDIAN_BYTE_SIZE_SMALL_LEGACY_TX_ENCODED
Median observed size in bytes of a small encoded legacy transaction.

Functions§

approx_capacity_get_pooled_transactions_req_eth66
Returns the approx number of transactions that a GetPooledTransactions request will have capacity for w.r.t. the Eth66 protocol version. This is useful for preallocating memory.
approx_capacity_get_pooled_transactions_req_eth68
Returns the approx number of transaction hashes that a GetPooledTransactions request will have capacity for w.r.t. the Eth68 protocol version. This is useful for preallocating memory.