ouroboros-consensus
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.Mempool.Update

Description

Operations that update the mempool. They are internally divided in the pure and impure sides of the operation.

Synopsis

Documentation

data WhichAddTx (f ∷ TypeType) where Source #

A GADT that enables the shared implementation of addTx and testTryAddTx.

Constructors

ProductionAddTxWhichAddTx Identity 
TestingAddTx ∷ !DiffTimeWhichAddTx Maybe

The argument unique to testTryAddTx.

The Nothing result means the tx would not fit in the current mempool; the testing implementation gives up instead of retrying indefinitely.

implAddTx Source #

Arguments

∷ (IOLike m, MonadTimer m, LedgerSupportsMempool blk, HasTxId (GenTx blk)) 
MempoolEnv m blk 
WhichAddTx f 
AddTxOnBehalfOf

Whether we're acting on behalf of a remote peer or a local client.

GenTx blk

The transaction to add to the mempool.

→ m (f (MempoolAddTxResult blk)) 

Add a single transaction to the mempool.

If there is no space, then the ProductionAddTx caller will block until there space, and try again, repeatedly until it succeeds. It only releases the lock when this loop terminates.

If there is no space, the TestingAddTx caller will immediately return Nothing.

implSyncWithLedger Source #

Arguments

∷ (IOLike m, LedgerSupportsMempool blk, ValidateEnvelope blk, HasTxId (GenTx blk)) 
⇒ (InternalState blk → r)

This argument is only to be able to acquire a snapshot in the same atomically block as the re-sync when testing the mempool in the QSM parallel tests. We could instead always compute a snapshot and ignore it in the common case, but it seems acceptable to not even create the thunk for it. This will be set to const () on the code that is run by the node.

MempoolEnv m blk 
→ m r