{-# LANGUAGE FlexibleContexts #-}
module Ouroboros.Consensus.Mempool.Query (pureGetSnapshotFor) where
import Ouroboros.Consensus.HeaderValidation
import Ouroboros.Consensus.Ledger.Abstract
import Ouroboros.Consensus.Ledger.SupportsMempool
import Ouroboros.Consensus.Mempool.API
import Ouroboros.Consensus.Mempool.Capacity
import Ouroboros.Consensus.Mempool.Impl.Common
pureGetSnapshotFor ::
( LedgerSupportsMempool blk
, HasTxId (GenTx blk)
, ValidateEnvelope blk
)
=> LedgerConfig blk
-> ForgeLedgerState blk
-> MempoolCapacityBytesOverride
-> InternalState blk
-> MempoolSnapshot blk
pureGetSnapshotFor :: forall blk.
(LedgerSupportsMempool blk, HasTxId (GenTx blk),
ValidateEnvelope blk) =>
LedgerConfig blk
-> ForgeLedgerState blk
-> MempoolCapacityBytesOverride
-> InternalState blk
-> MempoolSnapshot blk
pureGetSnapshotFor LedgerConfig blk
cfg ForgeLedgerState blk
blockLedgerState MempoolCapacityBytesOverride
capacityOverride =
InternalState blk -> MempoolSnapshot blk
forall blk.
(HasTxId (GenTx blk), TxLimits blk) =>
InternalState blk -> MempoolSnapshot blk
snapshotFromIS
(InternalState blk -> MempoolSnapshot blk)
-> (InternalState blk -> InternalState blk)
-> InternalState blk
-> MempoolSnapshot blk
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ValidationResult (Validated (GenTx blk)) blk -> InternalState blk
forall invalidTx blk.
ValidationResult invalidTx blk -> InternalState blk
internalStateFromVR
(ValidationResult (Validated (GenTx blk)) blk -> InternalState blk)
-> (InternalState blk
-> ValidationResult (Validated (GenTx blk)) blk)
-> InternalState blk
-> InternalState blk
forall b c a. (b -> c) -> (a -> b) -> a -> c
. MempoolCapacityBytesOverride
-> LedgerConfig blk
-> ForgeLedgerState blk
-> InternalState blk
-> ValidationResult (Validated (GenTx blk)) blk
forall blk.
(LedgerSupportsMempool blk, HasTxId (GenTx blk),
ValidateEnvelope blk) =>
MempoolCapacityBytesOverride
-> LedgerConfig blk
-> ForgeLedgerState blk
-> InternalState blk
-> ValidationResult (Validated (GenTx blk)) blk
validateStateFor MempoolCapacityBytesOverride
capacityOverride LedgerConfig blk
cfg ForgeLedgerState blk
blockLedgerState