cardano-rpc
Safe HaskellNone
LanguageHaskell2010

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

Documentation

watchMempoolMethod Source #

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.

watchMempoolStream Source #

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).