Module zebrad::components::mempool::downloads
source · Expand description
Transaction downloader and verifier.
The main struct Downloads
allows downloading and verifying transactions.
It is used by the mempool to get transactions into it. It is also able to
just verify transactions that were directly pushed.
The verification itself is done by the zebra_consensus
crate.
Verified transactions are returned to the caller in Downloads::poll_next
.
This is in contrast to the block downloader and verifiers which don’t
return anything and forward the verified blocks to the state themselves.
§Correctness
The mempool downloader doesn’t send verified transactions to the Mempool
service. So Zebra must spawn a task that regularly polls the downloader for
ready transactions. (To ensure that transactions propagate across the entire
network in each 75s block interval, the polling interval should be around
5-10 seconds.)
Polling the downloader from Mempool::poll_ready
is not sufficient.
[Service::poll_ready
] is only called when there is a service request.
But we want to download and gossip transactions,
even when there are no other service requests.
Structs§
- A marker struct for the oneshot channels which cancel a pending download and verify.
- Represents a [
Stream
] of download and verification tasks.
Enums§
- Errors that can occur while downloading and verifying a transaction.
Constants§
- The maximum number of concurrent inbound download and verify tasks.
- Controls how long we wait for a transaction download request to complete.
- Controls how long we wait for a transaction verify request to complete.
Type Aliases§
- BoxError 🔒