Mempool architecture diagram
The Mempool service owns storage and download/verification tasks.
The downloader returns candidates; only the service admits them to storage.
Arrows carry requests or events; gossip_mempool_transaction_id is a task,
not a Tower service.
flowchart TD
inbound["Inbound"] -->|QueueFromPeer| mempool["Mempool"]
rpc["RpcImpl"] -->|Queue or queries| mempool
crawler["Crawler"] -->|MempoolTransactionIds| network["NetworkService / PeerSet"]
crawler -->|Queue| mempool
checker["QueueChecker"] -->|CheckForVerifiedTransactions| mempool
mempool -->|admit candidate| downloads["Downloads"]
downloads -->|TransactionsById when needed| network
downloads -->|Transaction and Tip queries| state["StateService"]
downloads -->|MempoolRequest| verifier["MempoolTxVerifier"]
verifier -->|unspent outputs, anchors, nullifiers, time| state
verifier -->|AwaitOutput| mempool
downloads -->|completed results in poll_ready| mempool
mempool -->|insert or remove| storage["Storage"]
storage --> verified["VerifiedSet"]
storage --> pending["PendingOutputs"]
storage --> rejected["EvictionList"]
tip["ChainTipChange / LatestChainTip"] --> mempool
status["SyncStatus"] -->|initial activation| mempool
status -->|crawl gating| crawler
mempool -->|MempoolChange added| gossip["gossip_mempool_transaction_id"]
gossip -->|AdvertiseTransactionIds| network
Components
| Component | Responsibility |
|---|---|
Mempool | Dispatch requests, collect completed verification results in poll_ready, update storage for tip changes, and publish MempoolChange events. |
Downloads | Deduplicate queued candidates, enforce global and per-peer admission bounds, check whether a transaction is already mined, download missing bytes, and call the verifier. |
MempoolTxVerifier | Verify for the next block height using chain state and, for transparent dependencies, outputs awaited from the mempool. |
Storage | Apply standardness and cost-limit policy; own the verified set, pending-output requests, and rejection caches. |
VerifiedSet | Index transactions, created and spent outputs, nullifiers, and dependencies; perform weighted eviction and remove dependent transactions. |
PendingOutputs | Hold callers waiting for transparent outputs and respond when a parent transaction is inserted. |
EvictionList | Retain bounded, timed lists of transaction IDs rejected for chain effects, including random eviction. |
Crawler | Query peer mempools and queue returned IDs. |
QueueChecker | Trigger completion processing without external requests. |
gossip_mempool_transaction_id | Consume added-transaction events, combine available IDs, and advertise them through the network service. |
The mempool specification defines activation, task startup and timing, admission, eviction, rejection lifetimes, tip resets, and the service API.