Skip to main content

GossipedBlockDownloads

Type Alias GossipedBlockDownloads 

Source
type GossipedBlockDownloads = Downloads<Buffer<BoxService<Request, Response, BoxError>, Request>, Timeout<Buffer<BoxService<Request, Hash, RouterError>, Request>>, Buffer<BoxService<Request, Response, BoxError>, Request>, LatestChainTip>;

Aliased Type§

struct GossipedBlockDownloads {
    full_verify_concurrency_limit: usize,
    network: Buffer<BoxService<Request, Response, Box<dyn Error + Send + Sync>>, Request>,
    verifier: Timeout<Buffer<BoxService<Request, Hash, RouterError>, Request>>,
    state: Buffer<BoxService<Request, Response, Box<dyn Error + Send + Sync>>, Request>,
    read_state: Option<ReadStateService>,
    latest_chain_tip: LatestChainTip,
    pending: FuturesUnordered<JoinHandle<Result<Hash, (Box<dyn Error + Send + Sync>, Hash, Option<PeerSocketAddr>)>>>,
    cancel_handles: HashMap<Hash, (Sender<()>, Option<IpAddr>)>,
    in_flight_ips: HashSet<IpAddr>,
    rejected_early_blocks: IndexSet<Hash>,
    early_relay_allowances: EarlyRelayAllowances,
}

Fields§

§full_verify_concurrency_limit: usize

The configured full verification concurrency limit, after applying the minimum limit.

§network: Buffer<BoxService<Request, Response, Box<dyn Error + Send + Sync>>, Request>

A service that forwards requests to connected peers, and returns their responses.

§verifier: Timeout<Buffer<BoxService<Request, Hash, RouterError>, Request>>

A service that verifies downloaded blocks.

§state: Buffer<BoxService<Request, Response, Box<dyn Error + Send + Sync>>, Request>

A service that manages cached blockchain state.

§read_state: Option<ReadStateService>

A read-only state service, which checks a block from a peer that negotiated compact block relay when the block fails later validation, before the failure is exempt from scoring.

Without it, no failure is exempt.

§latest_chain_tip: LatestChainTip

Allows efficient access to the best tip of the blockchain.

§pending: FuturesUnordered<JoinHandle<Result<Hash, (Box<dyn Error + Send + Sync>, Hash, Option<PeerSocketAddr>)>>>

A list of pending block download and verify tasks.

§cancel_handles: HashMap<Hash, (Sender<()>, Option<IpAddr>)>

Cancellation handles for tasks in Self::pending, keyed by block hash. The Option<IpAddr> is the advertiser IP recorded in Self::in_flight_ips, so completion can remove it by hash lookup.

§in_flight_ips: HashSet<IpAddr>

Advertiser IPs with an in-flight download and verify task.

Invariant: an IP is present iff some entry in Self::cancel_handles has value (_, Some(ip)). Enforces the one-download-per-IP cap.

Size-bounded by full_verify_concurrency_limit (≤ MAX_INBOUND_CONCURRENCY), inherited from the DownloadAction::FullQueue check on Self::pending.

§rejected_early_blocks: IndexSet<Hash>

The hashes of blocks from peers that negotiated compact block relay, which passed the checks that authenticate them for early relay and then failed later validation, oldest first.

Each of these hashes commits to its block’s transactions and their authorizing data, so the downloader ignores them instead of verifying the same invalid blocks again. See remember_rejected_early_block().

§early_relay_allowances: EarlyRelayAllowances

The peer groups that have used their allowance for a block on a parent, which passed the checks that authenticate it for early relay and then failed later validation.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 680 bytes