{-# LANGUAGE NumericUnderscores #-}
module Ouroboros.Network.TxSubmission.Inbound.V2.Policy
( TxDecisionPolicy (..)
, defaultTxDecisionPolicy
, max_TX_SIZE
, NumTxIdsToReq (..)
) where
import Control.Monad.Class.MonadTime.SI
import Ouroboros.Network.Protocol.TxSubmission2.Type (NumTxIdsToReq (..))
import Ouroboros.Network.SizeInBytes (SizeInBytes (..))
max_TX_SIZE :: SizeInBytes
max_TX_SIZE :: SizeInBytes
max_TX_SIZE = SizeInBytes
65_540
data TxDecisionPolicy = TxDecisionPolicy {
TxDecisionPolicy -> NumTxIdsToReq
maxNumTxIdsToRequest :: !NumTxIdsToReq,
TxDecisionPolicy -> NumTxIdsToReq
maxUnacknowledgedTxIds :: !NumTxIdsToReq,
TxDecisionPolicy -> SizeInBytes
txsSizeInflightPerPeer :: !SizeInBytes,
TxDecisionPolicy -> SizeInBytes
maxTxsSizeInflight :: !SizeInBytes,
TxDecisionPolicy -> Int
txInflightMultiplicity :: !Int,
TxDecisionPolicy -> DiffTime
bufferedTxsMinLifetime :: !DiffTime,
TxDecisionPolicy -> Double
scoreRate :: !Double,
TxDecisionPolicy -> Double
scoreMax :: !Double
}
deriving Int -> TxDecisionPolicy -> ShowS
[TxDecisionPolicy] -> ShowS
TxDecisionPolicy -> String
(Int -> TxDecisionPolicy -> ShowS)
-> (TxDecisionPolicy -> String)
-> ([TxDecisionPolicy] -> ShowS)
-> Show TxDecisionPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TxDecisionPolicy -> ShowS
showsPrec :: Int -> TxDecisionPolicy -> ShowS
$cshow :: TxDecisionPolicy -> String
show :: TxDecisionPolicy -> String
$cshowList :: [TxDecisionPolicy] -> ShowS
showList :: [TxDecisionPolicy] -> ShowS
Show
defaultTxDecisionPolicy :: TxDecisionPolicy
defaultTxDecisionPolicy :: TxDecisionPolicy
defaultTxDecisionPolicy =
TxDecisionPolicy {
maxNumTxIdsToRequest :: NumTxIdsToReq
maxNumTxIdsToRequest = NumTxIdsToReq
3,
maxUnacknowledgedTxIds :: NumTxIdsToReq
maxUnacknowledgedTxIds = NumTxIdsToReq
10,
txsSizeInflightPerPeer :: SizeInBytes
txsSizeInflightPerPeer = SizeInBytes
max_TX_SIZE SizeInBytes -> SizeInBytes -> SizeInBytes
forall a. Num a => a -> a -> a
* SizeInBytes
6,
maxTxsSizeInflight :: SizeInBytes
maxTxsSizeInflight = SizeInBytes
max_TX_SIZE SizeInBytes -> SizeInBytes -> SizeInBytes
forall a. Num a => a -> a -> a
* SizeInBytes
20,
txInflightMultiplicity :: Int
txInflightMultiplicity = Int
2,
bufferedTxsMinLifetime :: DiffTime
bufferedTxsMinLifetime = DiffTime
2,
scoreRate :: Double
scoreRate = Double
0.1,
scoreMax :: Double
scoreMax = Double
15 Double -> Double -> Double
forall a. Num a => a -> a -> a
* Double
60
}