| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Cardano.Rpc.Server.Internal.UtxoRpc.Mempool
Description
Handler for the WatchMempool SubmitService RPC method: stream
mempool transactions matching a predicate as they enter the mempool.
Synopsis
- watchMempoolMethod :: MonadRpc e m => Proto WatchMempoolRequest -> (NextElem (Proto WatchMempoolResponse) -> IO ()) -> m ()
- watchMempoolStream :: MonadIO m => m MempoolWatchSnapshot -> (MempoolWatchSnapshot -> m MempoolWatchSnapshot) -> Proto TxPredicate -> (NextElem (Proto WatchMempoolResponse) -> IO ()) -> m ()
Documentation
Arguments
| :: MonadRpc e m | |
| => Proto WatchMempoolRequest | Request containing a filter predicate |
| -> (NextElem (Proto WatchMempoolResponse) -> IO ()) | Callback used to send each streamed response |
| -> m () |
Handle the WatchMempool SubmitService RPC method.
Streams new mempool entries matching the request's predicate, each with
stage always STAGE_MEMPOOL (the first locally observable stage;
see matchesTxPredicate).
Runs until the client disconnects or the stream is otherwise closed.
Arguments
| :: MonadIO m | |
| => m MempoolWatchSnapshot | Read the current mempool watch snapshot, without blocking - used once, for the initial baseline |
| -> (MempoolWatchSnapshot -> m MempoolWatchSnapshot) | Block until the snapshot differs from the given one, then return the new one |
| -> Proto TxPredicate | Predicate filtering which new entries are sent |
| -> (NextElem (Proto WatchMempoolResponse) -> IO ()) | Callback used to send each streamed response |
| -> m () |
The WatchMempool streaming loop. Emits every mempool entry newer than
the last one seen, oldest first, filtered by the predicate.
Removals and slot-only changes (no new ticket) produce no message: the
proto has no representation for eviction, and a max-ticket comparison
upstream would otherwise miss exactly these transitions (see
nextMempoolWatchSnapshot).