module Ouroboros.Consensus.Node.ExitPolicy (
NodeToNodeInitiatorResult (..)
, returnPolicy
, ReturnPolicy
) where
import qualified Ouroboros.Consensus.MiniProtocol.ChainSync.Client as CSClient
import Ouroboros.Network.ExitPolicy
data NodeToNodeInitiatorResult =
ChainSyncInitiatorResult !CSClient.ChainSyncClientResult
| NoInitiatorResult
returnPolicy :: ReturnPolicy NodeToNodeInitiatorResult
returnPolicy :: ReturnPolicy NodeToNodeInitiatorResult
returnPolicy NodeToNodeInitiatorResult
NoInitiatorResult = DiffTime -> RepromoteDelay
RepromoteDelay DiffTime
10
returnPolicy (ChainSyncInitiatorResult ChainSyncClientResult
result) = case ChainSyncClientResult
result of
CSClient.ForkTooDeep Point blk
_ Our (Tip blk)
_ourTip Their (Tip blk)
_theirTip -> DiffTime -> RepromoteDelay
RepromoteDelay DiffTime
120
CSClient.NoMoreIntersection Our (Tip blk)
_ourTip Their (Tip blk)
_theirTip -> DiffTime -> RepromoteDelay
RepromoteDelay DiffTime
120
CSClient.RolledBackPastIntersection
Point blk
_ Our (Tip blk)
_ourTip Their (Tip blk)
_theirTip -> DiffTime -> RepromoteDelay
RepromoteDelay DiffTime
180
ChainSyncClientResult
CSClient.AskedToTerminate -> DiffTime -> RepromoteDelay
RepromoteDelay DiffTime
10