{-# OPTIONS_HADDOCK prune #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}

-- |
-- Module: Lightning.Protocol.BOLT2.Messages
-- Copyright: (c) 2025 Jared Tobin
-- License: MIT
-- Maintainer: Jared Tobin <jared@ppad.tech>
--
-- Message types for BOLT #2 peer protocol.
--
-- This module defines per-message record types and a top-level Message
-- sum type for all BOLT #2 messages.

module Lightning.Protocol.BOLT2.Messages (
  -- * Message type codes
    MsgType(..)
  , msgTypeWord

  -- * Top-level message type
  , Message(..)

  -- * Channel establishment v1
  , OpenChannel(..)
  , AcceptChannel(..)
  , FundingCreated(..)
  , FundingSigned(..)
  , ChannelReady(..)

  -- * Channel establishment v2
  , OpenChannel2(..)
  , AcceptChannel2(..)
  , TxAddInput(..)
  , TxAddOutput(..)
  , TxRemoveInput(..)
  , TxRemoveOutput(..)
  , TxComplete(..)
  , TxSignatures(..)
  , TxInitRbf(..)
  , TxAckRbf(..)
  , TxAbort(..)

  -- * Channel close
  , Stfu(..)
  , Shutdown(..)
  , ClosingSigned(..)
  , ClosingComplete(..)
  , ClosingSig(..)

  -- * Normal operation
  , UpdateAddHtlc(..)
  , UpdateFulfillHtlc(..)
  , UpdateFailHtlc(..)
  , UpdateFailMalformedHtlc(..)
  , CommitmentSigned(..)
  , RevokeAndAck(..)
  , UpdateFee(..)

  -- * Reestablishment
  , ChannelReestablish(..)

  -- * Witness data
  , Witness(..)
  ) where

import Control.DeepSeq (NFData)
import qualified Data.ByteString as BS
import Data.Word (Word8, Word16, Word32, Word64)
import GHC.Generics (Generic)
import Lightning.Protocol.BOLT1 (TlvStream)
import Lightning.Protocol.BOLT2.Types

-- Message type codes ----------------------------------------------------------

-- | BOLT #2 message type codes.
data MsgType
  = MsgStfu                    -- ^ 2
  | MsgOpenChannel             -- ^ 32
  | MsgAcceptChannel           -- ^ 33
  | MsgFundingCreated          -- ^ 34
  | MsgFundingSigned           -- ^ 35
  | MsgChannelReady            -- ^ 36
  | MsgShutdown                -- ^ 38
  | MsgClosingSigned           -- ^ 39
  | MsgClosingComplete         -- ^ 40
  | MsgClosingSig              -- ^ 41
  | MsgOpenChannel2            -- ^ 64
  | MsgAcceptChannel2          -- ^ 65
  | MsgTxAddInput              -- ^ 66
  | MsgTxAddOutput             -- ^ 67
  | MsgTxRemoveInput           -- ^ 68
  | MsgTxRemoveOutput          -- ^ 69
  | MsgTxComplete              -- ^ 70
  | MsgTxSignatures            -- ^ 71
  | MsgTxInitRbf               -- ^ 72
  | MsgTxAckRbf                -- ^ 73
  | MsgTxAbort                 -- ^ 74
  | MsgUpdateAddHtlc           -- ^ 128
  | MsgUpdateFulfillHtlc       -- ^ 130
  | MsgUpdateFailHtlc          -- ^ 131
  | MsgCommitmentSigned        -- ^ 132
  | MsgRevokeAndAck            -- ^ 133
  | MsgUpdateFee               -- ^ 134
  | MsgUpdateFailMalformedHtlc -- ^ 135
  | MsgChannelReestablish      -- ^ 136
  deriving stock (MsgType -> MsgType -> Bool
(MsgType -> MsgType -> Bool)
-> (MsgType -> MsgType -> Bool) -> Eq MsgType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MsgType -> MsgType -> Bool
== :: MsgType -> MsgType -> Bool
$c/= :: MsgType -> MsgType -> Bool
/= :: MsgType -> MsgType -> Bool
Eq, Eq MsgType
Eq MsgType =>
(MsgType -> MsgType -> Ordering)
-> (MsgType -> MsgType -> Bool)
-> (MsgType -> MsgType -> Bool)
-> (MsgType -> MsgType -> Bool)
-> (MsgType -> MsgType -> Bool)
-> (MsgType -> MsgType -> MsgType)
-> (MsgType -> MsgType -> MsgType)
-> Ord MsgType
MsgType -> MsgType -> Bool
MsgType -> MsgType -> Ordering
MsgType -> MsgType -> MsgType
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: MsgType -> MsgType -> Ordering
compare :: MsgType -> MsgType -> Ordering
$c< :: MsgType -> MsgType -> Bool
< :: MsgType -> MsgType -> Bool
$c<= :: MsgType -> MsgType -> Bool
<= :: MsgType -> MsgType -> Bool
$c> :: MsgType -> MsgType -> Bool
> :: MsgType -> MsgType -> Bool
$c>= :: MsgType -> MsgType -> Bool
>= :: MsgType -> MsgType -> Bool
$cmax :: MsgType -> MsgType -> MsgType
max :: MsgType -> MsgType -> MsgType
$cmin :: MsgType -> MsgType -> MsgType
min :: MsgType -> MsgType -> MsgType
Ord, Int -> MsgType -> ShowS
[MsgType] -> ShowS
MsgType -> String
(Int -> MsgType -> ShowS)
-> (MsgType -> String) -> ([MsgType] -> ShowS) -> Show MsgType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MsgType -> ShowS
showsPrec :: Int -> MsgType -> ShowS
$cshow :: MsgType -> String
show :: MsgType -> String
$cshowList :: [MsgType] -> ShowS
showList :: [MsgType] -> ShowS
Show, (forall x. MsgType -> Rep MsgType x)
-> (forall x. Rep MsgType x -> MsgType) -> Generic MsgType
forall x. Rep MsgType x -> MsgType
forall x. MsgType -> Rep MsgType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. MsgType -> Rep MsgType x
from :: forall x. MsgType -> Rep MsgType x
$cto :: forall x. Rep MsgType x -> MsgType
to :: forall x. Rep MsgType x -> MsgType
Generic)

instance NFData MsgType

-- | Get the numeric type code for a message type.
msgTypeWord :: MsgType -> Word16
msgTypeWord :: MsgType -> Word16
msgTypeWord MsgType
MsgStfu                    = Word16
2
msgTypeWord MsgType
MsgOpenChannel             = Word16
32
msgTypeWord MsgType
MsgAcceptChannel           = Word16
33
msgTypeWord MsgType
MsgFundingCreated          = Word16
34
msgTypeWord MsgType
MsgFundingSigned           = Word16
35
msgTypeWord MsgType
MsgChannelReady            = Word16
36
msgTypeWord MsgType
MsgShutdown                = Word16
38
msgTypeWord MsgType
MsgClosingSigned           = Word16
39
msgTypeWord MsgType
MsgClosingComplete         = Word16
40
msgTypeWord MsgType
MsgClosingSig              = Word16
41
msgTypeWord MsgType
MsgOpenChannel2            = Word16
64
msgTypeWord MsgType
MsgAcceptChannel2          = Word16
65
msgTypeWord MsgType
MsgTxAddInput              = Word16
66
msgTypeWord MsgType
MsgTxAddOutput             = Word16
67
msgTypeWord MsgType
MsgTxRemoveInput           = Word16
68
msgTypeWord MsgType
MsgTxRemoveOutput          = Word16
69
msgTypeWord MsgType
MsgTxComplete              = Word16
70
msgTypeWord MsgType
MsgTxSignatures            = Word16
71
msgTypeWord MsgType
MsgTxInitRbf               = Word16
72
msgTypeWord MsgType
MsgTxAckRbf                = Word16
73
msgTypeWord MsgType
MsgTxAbort                 = Word16
74
msgTypeWord MsgType
MsgUpdateAddHtlc           = Word16
128
msgTypeWord MsgType
MsgUpdateFulfillHtlc       = Word16
130
msgTypeWord MsgType
MsgUpdateFailHtlc          = Word16
131
msgTypeWord MsgType
MsgCommitmentSigned        = Word16
132
msgTypeWord MsgType
MsgRevokeAndAck            = Word16
133
msgTypeWord MsgType
MsgUpdateFee               = Word16
134
msgTypeWord MsgType
MsgUpdateFailMalformedHtlc = Word16
135
msgTypeWord MsgType
MsgChannelReestablish      = Word16
136
{-# INLINE msgTypeWord #-}

-- Channel establishment v1 ----------------------------------------------------

-- | The open_channel message (type 32).
--
-- Contains information about a node and indicates its desire to set up
-- a new channel.
data OpenChannel = OpenChannel
  { OpenChannel -> ChainHash
openChannelChainHash             :: !ChainHash
  , OpenChannel -> ChannelId
openChannelTempChannelId         :: !ChannelId
  , OpenChannel -> Satoshis
openChannelFundingSatoshis       :: {-# UNPACK #-} !Satoshis
  , OpenChannel -> MilliSatoshis
openChannelPushMsat              :: {-# UNPACK #-} !MilliSatoshis
  , OpenChannel -> Satoshis
openChannelDustLimitSatoshis     :: {-# UNPACK #-} !Satoshis
  , OpenChannel -> MilliSatoshis
openChannelMaxHtlcValueInFlight  :: {-# UNPACK #-} !MilliSatoshis
  , OpenChannel -> Satoshis
openChannelChannelReserveSat     :: {-# UNPACK #-} !Satoshis
  , OpenChannel -> MilliSatoshis
openChannelHtlcMinimumMsat       :: {-# UNPACK #-} !MilliSatoshis
  , OpenChannel -> Word32
openChannelFeeratePerKw          :: {-# UNPACK #-} !Word32
  , OpenChannel -> Word16
openChannelToSelfDelay           :: {-# UNPACK #-} !Word16
  , OpenChannel -> Word16
openChannelMaxAcceptedHtlcs      :: {-# UNPACK #-} !Word16
  , OpenChannel -> Point
openChannelFundingPubkey         :: !Point
  , OpenChannel -> Point
openChannelRevocationBasepoint   :: !Point
  , OpenChannel -> Point
openChannelPaymentBasepoint      :: !Point
  , OpenChannel -> Point
openChannelDelayedPaymentBase    :: !Point
  , OpenChannel -> Point
openChannelHtlcBasepoint         :: !Point
  , OpenChannel -> Point
openChannelFirstPerCommitPoint   :: !Point
  , OpenChannel -> Word8
openChannelChannelFlags          :: {-# UNPACK #-} !Word8
  , OpenChannel -> TlvStream
openChannelTlvs                  :: !TlvStream
  } deriving stock (OpenChannel -> OpenChannel -> Bool
(OpenChannel -> OpenChannel -> Bool)
-> (OpenChannel -> OpenChannel -> Bool) -> Eq OpenChannel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: OpenChannel -> OpenChannel -> Bool
== :: OpenChannel -> OpenChannel -> Bool
$c/= :: OpenChannel -> OpenChannel -> Bool
/= :: OpenChannel -> OpenChannel -> Bool
Eq, Int -> OpenChannel -> ShowS
[OpenChannel] -> ShowS
OpenChannel -> String
(Int -> OpenChannel -> ShowS)
-> (OpenChannel -> String)
-> ([OpenChannel] -> ShowS)
-> Show OpenChannel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> OpenChannel -> ShowS
showsPrec :: Int -> OpenChannel -> ShowS
$cshow :: OpenChannel -> String
show :: OpenChannel -> String
$cshowList :: [OpenChannel] -> ShowS
showList :: [OpenChannel] -> ShowS
Show, (forall x. OpenChannel -> Rep OpenChannel x)
-> (forall x. Rep OpenChannel x -> OpenChannel)
-> Generic OpenChannel
forall x. Rep OpenChannel x -> OpenChannel
forall x. OpenChannel -> Rep OpenChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. OpenChannel -> Rep OpenChannel x
from :: forall x. OpenChannel -> Rep OpenChannel x
$cto :: forall x. Rep OpenChannel x -> OpenChannel
to :: forall x. Rep OpenChannel x -> OpenChannel
Generic)

instance NFData OpenChannel

-- | The accept_channel message (type 33).
--
-- Contains information about a node and indicates its acceptance of
-- the new channel.
data AcceptChannel = AcceptChannel
  { AcceptChannel -> ChannelId
acceptChannelTempChannelId       :: !ChannelId
  , AcceptChannel -> Satoshis
acceptChannelDustLimitSatoshis   :: {-# UNPACK #-} !Satoshis
  , AcceptChannel -> MilliSatoshis
acceptChannelMaxHtlcValueInFlight :: {-# UNPACK #-} !MilliSatoshis
  , AcceptChannel -> Satoshis
acceptChannelChannelReserveSat   :: {-# UNPACK #-} !Satoshis
  , AcceptChannel -> MilliSatoshis
acceptChannelHtlcMinimumMsat     :: {-# UNPACK #-} !MilliSatoshis
  , AcceptChannel -> Word32
acceptChannelMinimumDepth        :: {-# UNPACK #-} !Word32
  , AcceptChannel -> Word16
acceptChannelToSelfDelay         :: {-# UNPACK #-} !Word16
  , AcceptChannel -> Word16
acceptChannelMaxAcceptedHtlcs    :: {-# UNPACK #-} !Word16
  , AcceptChannel -> Point
acceptChannelFundingPubkey       :: !Point
  , AcceptChannel -> Point
acceptChannelRevocationBasepoint :: !Point
  , AcceptChannel -> Point
acceptChannelPaymentBasepoint    :: !Point
  , AcceptChannel -> Point
acceptChannelDelayedPaymentBase  :: !Point
  , AcceptChannel -> Point
acceptChannelHtlcBasepoint       :: !Point
  , AcceptChannel -> Point
acceptChannelFirstPerCommitPoint :: !Point
  , AcceptChannel -> TlvStream
acceptChannelTlvs                :: !TlvStream
  } deriving stock (AcceptChannel -> AcceptChannel -> Bool
(AcceptChannel -> AcceptChannel -> Bool)
-> (AcceptChannel -> AcceptChannel -> Bool) -> Eq AcceptChannel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AcceptChannel -> AcceptChannel -> Bool
== :: AcceptChannel -> AcceptChannel -> Bool
$c/= :: AcceptChannel -> AcceptChannel -> Bool
/= :: AcceptChannel -> AcceptChannel -> Bool
Eq, Int -> AcceptChannel -> ShowS
[AcceptChannel] -> ShowS
AcceptChannel -> String
(Int -> AcceptChannel -> ShowS)
-> (AcceptChannel -> String)
-> ([AcceptChannel] -> ShowS)
-> Show AcceptChannel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AcceptChannel -> ShowS
showsPrec :: Int -> AcceptChannel -> ShowS
$cshow :: AcceptChannel -> String
show :: AcceptChannel -> String
$cshowList :: [AcceptChannel] -> ShowS
showList :: [AcceptChannel] -> ShowS
Show, (forall x. AcceptChannel -> Rep AcceptChannel x)
-> (forall x. Rep AcceptChannel x -> AcceptChannel)
-> Generic AcceptChannel
forall x. Rep AcceptChannel x -> AcceptChannel
forall x. AcceptChannel -> Rep AcceptChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. AcceptChannel -> Rep AcceptChannel x
from :: forall x. AcceptChannel -> Rep AcceptChannel x
$cto :: forall x. Rep AcceptChannel x -> AcceptChannel
to :: forall x. Rep AcceptChannel x -> AcceptChannel
Generic)

instance NFData AcceptChannel

-- | The funding_created message (type 34).
--
-- Describes the outpoint which the funder has created for the initial
-- commitment transactions.
data FundingCreated = FundingCreated
  { FundingCreated -> ChannelId
fundingCreatedTempChannelId   :: !ChannelId
  , FundingCreated -> TxId
fundingCreatedFundingTxid     :: !TxId
  , FundingCreated -> Word16
fundingCreatedFundingOutIdx   :: {-# UNPACK #-} !Word16
  , FundingCreated -> Signature
fundingCreatedSignature       :: !Signature
  } deriving stock (FundingCreated -> FundingCreated -> Bool
(FundingCreated -> FundingCreated -> Bool)
-> (FundingCreated -> FundingCreated -> Bool) -> Eq FundingCreated
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FundingCreated -> FundingCreated -> Bool
== :: FundingCreated -> FundingCreated -> Bool
$c/= :: FundingCreated -> FundingCreated -> Bool
/= :: FundingCreated -> FundingCreated -> Bool
Eq, Int -> FundingCreated -> ShowS
[FundingCreated] -> ShowS
FundingCreated -> String
(Int -> FundingCreated -> ShowS)
-> (FundingCreated -> String)
-> ([FundingCreated] -> ShowS)
-> Show FundingCreated
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FundingCreated -> ShowS
showsPrec :: Int -> FundingCreated -> ShowS
$cshow :: FundingCreated -> String
show :: FundingCreated -> String
$cshowList :: [FundingCreated] -> ShowS
showList :: [FundingCreated] -> ShowS
Show, (forall x. FundingCreated -> Rep FundingCreated x)
-> (forall x. Rep FundingCreated x -> FundingCreated)
-> Generic FundingCreated
forall x. Rep FundingCreated x -> FundingCreated
forall x. FundingCreated -> Rep FundingCreated x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FundingCreated -> Rep FundingCreated x
from :: forall x. FundingCreated -> Rep FundingCreated x
$cto :: forall x. Rep FundingCreated x -> FundingCreated
to :: forall x. Rep FundingCreated x -> FundingCreated
Generic)

instance NFData FundingCreated

-- | The funding_signed message (type 35).
--
-- Gives the funder the signature for the first commitment transaction.
data FundingSigned = FundingSigned
  { FundingSigned -> ChannelId
fundingSignedChannelId  :: !ChannelId
  , FundingSigned -> Signature
fundingSignedSignature  :: !Signature
  } deriving stock (FundingSigned -> FundingSigned -> Bool
(FundingSigned -> FundingSigned -> Bool)
-> (FundingSigned -> FundingSigned -> Bool) -> Eq FundingSigned
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FundingSigned -> FundingSigned -> Bool
== :: FundingSigned -> FundingSigned -> Bool
$c/= :: FundingSigned -> FundingSigned -> Bool
/= :: FundingSigned -> FundingSigned -> Bool
Eq, Int -> FundingSigned -> ShowS
[FundingSigned] -> ShowS
FundingSigned -> String
(Int -> FundingSigned -> ShowS)
-> (FundingSigned -> String)
-> ([FundingSigned] -> ShowS)
-> Show FundingSigned
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FundingSigned -> ShowS
showsPrec :: Int -> FundingSigned -> ShowS
$cshow :: FundingSigned -> String
show :: FundingSigned -> String
$cshowList :: [FundingSigned] -> ShowS
showList :: [FundingSigned] -> ShowS
Show, (forall x. FundingSigned -> Rep FundingSigned x)
-> (forall x. Rep FundingSigned x -> FundingSigned)
-> Generic FundingSigned
forall x. Rep FundingSigned x -> FundingSigned
forall x. FundingSigned -> Rep FundingSigned x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FundingSigned -> Rep FundingSigned x
from :: forall x. FundingSigned -> Rep FundingSigned x
$cto :: forall x. Rep FundingSigned x -> FundingSigned
to :: forall x. Rep FundingSigned x -> FundingSigned
Generic)

instance NFData FundingSigned

-- | The channel_ready message (type 36).
--
-- Indicates that the funding transaction has sufficient confirms for
-- channel use.
data ChannelReady = ChannelReady
  { ChannelReady -> ChannelId
channelReadyChannelId            :: !ChannelId
  , ChannelReady -> Point
channelReadySecondPerCommitPoint :: !Point
  , ChannelReady -> TlvStream
channelReadyTlvs                 :: !TlvStream
  } deriving stock (ChannelReady -> ChannelReady -> Bool
(ChannelReady -> ChannelReady -> Bool)
-> (ChannelReady -> ChannelReady -> Bool) -> Eq ChannelReady
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ChannelReady -> ChannelReady -> Bool
== :: ChannelReady -> ChannelReady -> Bool
$c/= :: ChannelReady -> ChannelReady -> Bool
/= :: ChannelReady -> ChannelReady -> Bool
Eq, Int -> ChannelReady -> ShowS
[ChannelReady] -> ShowS
ChannelReady -> String
(Int -> ChannelReady -> ShowS)
-> (ChannelReady -> String)
-> ([ChannelReady] -> ShowS)
-> Show ChannelReady
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ChannelReady -> ShowS
showsPrec :: Int -> ChannelReady -> ShowS
$cshow :: ChannelReady -> String
show :: ChannelReady -> String
$cshowList :: [ChannelReady] -> ShowS
showList :: [ChannelReady] -> ShowS
Show, (forall x. ChannelReady -> Rep ChannelReady x)
-> (forall x. Rep ChannelReady x -> ChannelReady)
-> Generic ChannelReady
forall x. Rep ChannelReady x -> ChannelReady
forall x. ChannelReady -> Rep ChannelReady x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ChannelReady -> Rep ChannelReady x
from :: forall x. ChannelReady -> Rep ChannelReady x
$cto :: forall x. Rep ChannelReady x -> ChannelReady
to :: forall x. Rep ChannelReady x -> ChannelReady
Generic)

instance NFData ChannelReady

-- Channel establishment v2 ----------------------------------------------------

-- | The open_channel2 message (type 64).
--
-- Initiates the v2 channel establishment workflow.
data OpenChannel2 = OpenChannel2
  { OpenChannel2 -> ChainHash
openChannel2ChainHash            :: !ChainHash
  , OpenChannel2 -> ChannelId
openChannel2TempChannelId        :: !ChannelId
  , OpenChannel2 -> Word32
openChannel2FundingFeeratePerkw  :: {-# UNPACK #-} !Word32
  , OpenChannel2 -> Word32
openChannel2CommitFeeratePerkw   :: {-# UNPACK #-} !Word32
  , OpenChannel2 -> Satoshis
openChannel2FundingSatoshis      :: {-# UNPACK #-} !Satoshis
  , OpenChannel2 -> Satoshis
openChannel2DustLimitSatoshis    :: {-# UNPACK #-} !Satoshis
  , OpenChannel2 -> MilliSatoshis
openChannel2MaxHtlcValueInFlight :: {-# UNPACK #-} !MilliSatoshis
  , OpenChannel2 -> MilliSatoshis
openChannel2HtlcMinimumMsat      :: {-# UNPACK #-} !MilliSatoshis
  , OpenChannel2 -> Word16
openChannel2ToSelfDelay          :: {-# UNPACK #-} !Word16
  , OpenChannel2 -> Word16
openChannel2MaxAcceptedHtlcs     :: {-# UNPACK #-} !Word16
  , OpenChannel2 -> Word32
openChannel2Locktime             :: {-# UNPACK #-} !Word32
  , OpenChannel2 -> Point
openChannel2FundingPubkey        :: !Point
  , OpenChannel2 -> Point
openChannel2RevocationBasepoint  :: !Point
  , OpenChannel2 -> Point
openChannel2PaymentBasepoint     :: !Point
  , OpenChannel2 -> Point
openChannel2DelayedPaymentBase   :: !Point
  , OpenChannel2 -> Point
openChannel2HtlcBasepoint        :: !Point
  , OpenChannel2 -> Point
openChannel2FirstPerCommitPoint  :: !Point
  , OpenChannel2 -> Point
openChannel2SecondPerCommitPoint :: !Point
  , OpenChannel2 -> Word8
openChannel2ChannelFlags         :: {-# UNPACK #-} !Word8
  , OpenChannel2 -> TlvStream
openChannel2Tlvs                 :: !TlvStream
  } deriving stock (OpenChannel2 -> OpenChannel2 -> Bool
(OpenChannel2 -> OpenChannel2 -> Bool)
-> (OpenChannel2 -> OpenChannel2 -> Bool) -> Eq OpenChannel2
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: OpenChannel2 -> OpenChannel2 -> Bool
== :: OpenChannel2 -> OpenChannel2 -> Bool
$c/= :: OpenChannel2 -> OpenChannel2 -> Bool
/= :: OpenChannel2 -> OpenChannel2 -> Bool
Eq, Int -> OpenChannel2 -> ShowS
[OpenChannel2] -> ShowS
OpenChannel2 -> String
(Int -> OpenChannel2 -> ShowS)
-> (OpenChannel2 -> String)
-> ([OpenChannel2] -> ShowS)
-> Show OpenChannel2
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> OpenChannel2 -> ShowS
showsPrec :: Int -> OpenChannel2 -> ShowS
$cshow :: OpenChannel2 -> String
show :: OpenChannel2 -> String
$cshowList :: [OpenChannel2] -> ShowS
showList :: [OpenChannel2] -> ShowS
Show, (forall x. OpenChannel2 -> Rep OpenChannel2 x)
-> (forall x. Rep OpenChannel2 x -> OpenChannel2)
-> Generic OpenChannel2
forall x. Rep OpenChannel2 x -> OpenChannel2
forall x. OpenChannel2 -> Rep OpenChannel2 x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. OpenChannel2 -> Rep OpenChannel2 x
from :: forall x. OpenChannel2 -> Rep OpenChannel2 x
$cto :: forall x. Rep OpenChannel2 x -> OpenChannel2
to :: forall x. Rep OpenChannel2 x -> OpenChannel2
Generic)

instance NFData OpenChannel2

-- | The accept_channel2 message (type 65).
--
-- Indicates acceptance of the v2 channel.
data AcceptChannel2 = AcceptChannel2
  { AcceptChannel2 -> ChannelId
acceptChannel2TempChannelId        :: !ChannelId
  , AcceptChannel2 -> Satoshis
acceptChannel2FundingSatoshis      :: {-# UNPACK #-} !Satoshis
  , AcceptChannel2 -> Satoshis
acceptChannel2DustLimitSatoshis    :: {-# UNPACK #-} !Satoshis
  , AcceptChannel2 -> MilliSatoshis
acceptChannel2MaxHtlcValueInFlight :: {-# UNPACK #-} !MilliSatoshis
  , AcceptChannel2 -> MilliSatoshis
acceptChannel2HtlcMinimumMsat      :: {-# UNPACK #-} !MilliSatoshis
  , AcceptChannel2 -> Word32
acceptChannel2MinimumDepth         :: {-# UNPACK #-} !Word32
  , AcceptChannel2 -> Word16
acceptChannel2ToSelfDelay          :: {-# UNPACK #-} !Word16
  , AcceptChannel2 -> Word16
acceptChannel2MaxAcceptedHtlcs     :: {-# UNPACK #-} !Word16
  , AcceptChannel2 -> Point
acceptChannel2FundingPubkey        :: !Point
  , AcceptChannel2 -> Point
acceptChannel2RevocationBasepoint  :: !Point
  , AcceptChannel2 -> Point
acceptChannel2PaymentBasepoint     :: !Point
  , AcceptChannel2 -> Point
acceptChannel2DelayedPaymentBase   :: !Point
  , AcceptChannel2 -> Point
acceptChannel2HtlcBasepoint        :: !Point
  , AcceptChannel2 -> Point
acceptChannel2FirstPerCommitPoint  :: !Point
  , AcceptChannel2 -> Point
acceptChannel2SecondPerCommitPoint :: !Point
  , AcceptChannel2 -> TlvStream
acceptChannel2Tlvs                 :: !TlvStream
  } deriving stock (AcceptChannel2 -> AcceptChannel2 -> Bool
(AcceptChannel2 -> AcceptChannel2 -> Bool)
-> (AcceptChannel2 -> AcceptChannel2 -> Bool) -> Eq AcceptChannel2
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AcceptChannel2 -> AcceptChannel2 -> Bool
== :: AcceptChannel2 -> AcceptChannel2 -> Bool
$c/= :: AcceptChannel2 -> AcceptChannel2 -> Bool
/= :: AcceptChannel2 -> AcceptChannel2 -> Bool
Eq, Int -> AcceptChannel2 -> ShowS
[AcceptChannel2] -> ShowS
AcceptChannel2 -> String
(Int -> AcceptChannel2 -> ShowS)
-> (AcceptChannel2 -> String)
-> ([AcceptChannel2] -> ShowS)
-> Show AcceptChannel2
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AcceptChannel2 -> ShowS
showsPrec :: Int -> AcceptChannel2 -> ShowS
$cshow :: AcceptChannel2 -> String
show :: AcceptChannel2 -> String
$cshowList :: [AcceptChannel2] -> ShowS
showList :: [AcceptChannel2] -> ShowS
Show, (forall x. AcceptChannel2 -> Rep AcceptChannel2 x)
-> (forall x. Rep AcceptChannel2 x -> AcceptChannel2)
-> Generic AcceptChannel2
forall x. Rep AcceptChannel2 x -> AcceptChannel2
forall x. AcceptChannel2 -> Rep AcceptChannel2 x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. AcceptChannel2 -> Rep AcceptChannel2 x
from :: forall x. AcceptChannel2 -> Rep AcceptChannel2 x
$cto :: forall x. Rep AcceptChannel2 x -> AcceptChannel2
to :: forall x. Rep AcceptChannel2 x -> AcceptChannel2
Generic)

instance NFData AcceptChannel2

-- Interactive transaction construction ----------------------------------------

-- | The tx_add_input message (type 66).
--
-- Adds a transaction input to the collaborative transaction.
data TxAddInput = TxAddInput
  { TxAddInput -> ChannelId
txAddInputChannelId :: !ChannelId
  , TxAddInput -> Word64
txAddInputSerialId  :: {-# UNPACK #-} !Word64
  , TxAddInput -> ByteString
txAddInputPrevTx    :: !BS.ByteString
  , TxAddInput -> Word32
txAddInputPrevVout  :: {-# UNPACK #-} !Word32
  , TxAddInput -> Word32
txAddInputSequence  :: {-# UNPACK #-} !Word32
  } deriving stock (TxAddInput -> TxAddInput -> Bool
(TxAddInput -> TxAddInput -> Bool)
-> (TxAddInput -> TxAddInput -> Bool) -> Eq TxAddInput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TxAddInput -> TxAddInput -> Bool
== :: TxAddInput -> TxAddInput -> Bool
$c/= :: TxAddInput -> TxAddInput -> Bool
/= :: TxAddInput -> TxAddInput -> Bool
Eq, Int -> TxAddInput -> ShowS
[TxAddInput] -> ShowS
TxAddInput -> String
(Int -> TxAddInput -> ShowS)
-> (TxAddInput -> String)
-> ([TxAddInput] -> ShowS)
-> Show TxAddInput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TxAddInput -> ShowS
showsPrec :: Int -> TxAddInput -> ShowS
$cshow :: TxAddInput -> String
show :: TxAddInput -> String
$cshowList :: [TxAddInput] -> ShowS
showList :: [TxAddInput] -> ShowS
Show, (forall x. TxAddInput -> Rep TxAddInput x)
-> (forall x. Rep TxAddInput x -> TxAddInput) -> Generic TxAddInput
forall x. Rep TxAddInput x -> TxAddInput
forall x. TxAddInput -> Rep TxAddInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TxAddInput -> Rep TxAddInput x
from :: forall x. TxAddInput -> Rep TxAddInput x
$cto :: forall x. Rep TxAddInput x -> TxAddInput
to :: forall x. Rep TxAddInput x -> TxAddInput
Generic)

instance NFData TxAddInput

-- | The tx_add_output message (type 67).
--
-- Adds a transaction output to the collaborative transaction.
data TxAddOutput = TxAddOutput
  { TxAddOutput -> ChannelId
txAddOutputChannelId :: !ChannelId
  , TxAddOutput -> Word64
txAddOutputSerialId  :: {-# UNPACK #-} !Word64
  , TxAddOutput -> Satoshis
txAddOutputSats      :: {-# UNPACK #-} !Satoshis
  , TxAddOutput -> ScriptPubKey
txAddOutputScript    :: !ScriptPubKey
  } deriving stock (TxAddOutput -> TxAddOutput -> Bool
(TxAddOutput -> TxAddOutput -> Bool)
-> (TxAddOutput -> TxAddOutput -> Bool) -> Eq TxAddOutput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TxAddOutput -> TxAddOutput -> Bool
== :: TxAddOutput -> TxAddOutput -> Bool
$c/= :: TxAddOutput -> TxAddOutput -> Bool
/= :: TxAddOutput -> TxAddOutput -> Bool
Eq, Int -> TxAddOutput -> ShowS
[TxAddOutput] -> ShowS
TxAddOutput -> String
(Int -> TxAddOutput -> ShowS)
-> (TxAddOutput -> String)
-> ([TxAddOutput] -> ShowS)
-> Show TxAddOutput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TxAddOutput -> ShowS
showsPrec :: Int -> TxAddOutput -> ShowS
$cshow :: TxAddOutput -> String
show :: TxAddOutput -> String
$cshowList :: [TxAddOutput] -> ShowS
showList :: [TxAddOutput] -> ShowS
Show, (forall x. TxAddOutput -> Rep TxAddOutput x)
-> (forall x. Rep TxAddOutput x -> TxAddOutput)
-> Generic TxAddOutput
forall x. Rep TxAddOutput x -> TxAddOutput
forall x. TxAddOutput -> Rep TxAddOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TxAddOutput -> Rep TxAddOutput x
from :: forall x. TxAddOutput -> Rep TxAddOutput x
$cto :: forall x. Rep TxAddOutput x -> TxAddOutput
to :: forall x. Rep TxAddOutput x -> TxAddOutput
Generic)

instance NFData TxAddOutput

-- | The tx_remove_input message (type 68).
--
-- Removes a previously added input from the collaborative transaction.
data TxRemoveInput = TxRemoveInput
  { TxRemoveInput -> ChannelId
txRemoveInputChannelId :: !ChannelId
  , TxRemoveInput -> Word64
txRemoveInputSerialId  :: {-# UNPACK #-} !Word64
  } deriving stock (TxRemoveInput -> TxRemoveInput -> Bool
(TxRemoveInput -> TxRemoveInput -> Bool)
-> (TxRemoveInput -> TxRemoveInput -> Bool) -> Eq TxRemoveInput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TxRemoveInput -> TxRemoveInput -> Bool
== :: TxRemoveInput -> TxRemoveInput -> Bool
$c/= :: TxRemoveInput -> TxRemoveInput -> Bool
/= :: TxRemoveInput -> TxRemoveInput -> Bool
Eq, Int -> TxRemoveInput -> ShowS
[TxRemoveInput] -> ShowS
TxRemoveInput -> String
(Int -> TxRemoveInput -> ShowS)
-> (TxRemoveInput -> String)
-> ([TxRemoveInput] -> ShowS)
-> Show TxRemoveInput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TxRemoveInput -> ShowS
showsPrec :: Int -> TxRemoveInput -> ShowS
$cshow :: TxRemoveInput -> String
show :: TxRemoveInput -> String
$cshowList :: [TxRemoveInput] -> ShowS
showList :: [TxRemoveInput] -> ShowS
Show, (forall x. TxRemoveInput -> Rep TxRemoveInput x)
-> (forall x. Rep TxRemoveInput x -> TxRemoveInput)
-> Generic TxRemoveInput
forall x. Rep TxRemoveInput x -> TxRemoveInput
forall x. TxRemoveInput -> Rep TxRemoveInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TxRemoveInput -> Rep TxRemoveInput x
from :: forall x. TxRemoveInput -> Rep TxRemoveInput x
$cto :: forall x. Rep TxRemoveInput x -> TxRemoveInput
to :: forall x. Rep TxRemoveInput x -> TxRemoveInput
Generic)

instance NFData TxRemoveInput

-- | The tx_remove_output message (type 69).
--
-- Removes a previously added output from the collaborative transaction.
data TxRemoveOutput = TxRemoveOutput
  { TxRemoveOutput -> ChannelId
txRemoveOutputChannelId :: !ChannelId
  , TxRemoveOutput -> Word64
txRemoveOutputSerialId  :: {-# UNPACK #-} !Word64
  } deriving stock (TxRemoveOutput -> TxRemoveOutput -> Bool
(TxRemoveOutput -> TxRemoveOutput -> Bool)
-> (TxRemoveOutput -> TxRemoveOutput -> Bool) -> Eq TxRemoveOutput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TxRemoveOutput -> TxRemoveOutput -> Bool
== :: TxRemoveOutput -> TxRemoveOutput -> Bool
$c/= :: TxRemoveOutput -> TxRemoveOutput -> Bool
/= :: TxRemoveOutput -> TxRemoveOutput -> Bool
Eq, Int -> TxRemoveOutput -> ShowS
[TxRemoveOutput] -> ShowS
TxRemoveOutput -> String
(Int -> TxRemoveOutput -> ShowS)
-> (TxRemoveOutput -> String)
-> ([TxRemoveOutput] -> ShowS)
-> Show TxRemoveOutput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TxRemoveOutput -> ShowS
showsPrec :: Int -> TxRemoveOutput -> ShowS
$cshow :: TxRemoveOutput -> String
show :: TxRemoveOutput -> String
$cshowList :: [TxRemoveOutput] -> ShowS
showList :: [TxRemoveOutput] -> ShowS
Show, (forall x. TxRemoveOutput -> Rep TxRemoveOutput x)
-> (forall x. Rep TxRemoveOutput x -> TxRemoveOutput)
-> Generic TxRemoveOutput
forall x. Rep TxRemoveOutput x -> TxRemoveOutput
forall x. TxRemoveOutput -> Rep TxRemoveOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TxRemoveOutput -> Rep TxRemoveOutput x
from :: forall x. TxRemoveOutput -> Rep TxRemoveOutput x
$cto :: forall x. Rep TxRemoveOutput x -> TxRemoveOutput
to :: forall x. Rep TxRemoveOutput x -> TxRemoveOutput
Generic)

instance NFData TxRemoveOutput

-- | The tx_complete message (type 70).
--
-- Signals the conclusion of a peer's transaction contributions.
data TxComplete = TxComplete
  { TxComplete -> ChannelId
txCompleteChannelId :: !ChannelId
  } deriving stock (TxComplete -> TxComplete -> Bool
(TxComplete -> TxComplete -> Bool)
-> (TxComplete -> TxComplete -> Bool) -> Eq TxComplete
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TxComplete -> TxComplete -> Bool
== :: TxComplete -> TxComplete -> Bool
$c/= :: TxComplete -> TxComplete -> Bool
/= :: TxComplete -> TxComplete -> Bool
Eq, Int -> TxComplete -> ShowS
[TxComplete] -> ShowS
TxComplete -> String
(Int -> TxComplete -> ShowS)
-> (TxComplete -> String)
-> ([TxComplete] -> ShowS)
-> Show TxComplete
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TxComplete -> ShowS
showsPrec :: Int -> TxComplete -> ShowS
$cshow :: TxComplete -> String
show :: TxComplete -> String
$cshowList :: [TxComplete] -> ShowS
showList :: [TxComplete] -> ShowS
Show, (forall x. TxComplete -> Rep TxComplete x)
-> (forall x. Rep TxComplete x -> TxComplete) -> Generic TxComplete
forall x. Rep TxComplete x -> TxComplete
forall x. TxComplete -> Rep TxComplete x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TxComplete -> Rep TxComplete x
from :: forall x. TxComplete -> Rep TxComplete x
$cto :: forall x. Rep TxComplete x -> TxComplete
to :: forall x. Rep TxComplete x -> TxComplete
Generic)

instance NFData TxComplete

-- | Witness data for tx_signatures.
data Witness = Witness
  { Witness -> ByteString
witnessData :: !BS.ByteString
  } deriving stock (Witness -> Witness -> Bool
(Witness -> Witness -> Bool)
-> (Witness -> Witness -> Bool) -> Eq Witness
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Witness -> Witness -> Bool
== :: Witness -> Witness -> Bool
$c/= :: Witness -> Witness -> Bool
/= :: Witness -> Witness -> Bool
Eq, Int -> Witness -> ShowS
[Witness] -> ShowS
Witness -> String
(Int -> Witness -> ShowS)
-> (Witness -> String) -> ([Witness] -> ShowS) -> Show Witness
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Witness -> ShowS
showsPrec :: Int -> Witness -> ShowS
$cshow :: Witness -> String
show :: Witness -> String
$cshowList :: [Witness] -> ShowS
showList :: [Witness] -> ShowS
Show, (forall x. Witness -> Rep Witness x)
-> (forall x. Rep Witness x -> Witness) -> Generic Witness
forall x. Rep Witness x -> Witness
forall x. Witness -> Rep Witness x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Witness -> Rep Witness x
from :: forall x. Witness -> Rep Witness x
$cto :: forall x. Rep Witness x -> Witness
to :: forall x. Rep Witness x -> Witness
Generic)

instance NFData Witness

-- | The tx_signatures message (type 71).
--
-- Contains signatures for the collaborative transaction.
data TxSignatures = TxSignatures
  { TxSignatures -> ChannelId
txSignaturesChannelId :: !ChannelId
  , TxSignatures -> TxId
txSignaturesTxid      :: !TxId
  , TxSignatures -> [Witness]
txSignaturesWitnesses :: ![Witness]
  } deriving stock (TxSignatures -> TxSignatures -> Bool
(TxSignatures -> TxSignatures -> Bool)
-> (TxSignatures -> TxSignatures -> Bool) -> Eq TxSignatures
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TxSignatures -> TxSignatures -> Bool
== :: TxSignatures -> TxSignatures -> Bool
$c/= :: TxSignatures -> TxSignatures -> Bool
/= :: TxSignatures -> TxSignatures -> Bool
Eq, Int -> TxSignatures -> ShowS
[TxSignatures] -> ShowS
TxSignatures -> String
(Int -> TxSignatures -> ShowS)
-> (TxSignatures -> String)
-> ([TxSignatures] -> ShowS)
-> Show TxSignatures
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TxSignatures -> ShowS
showsPrec :: Int -> TxSignatures -> ShowS
$cshow :: TxSignatures -> String
show :: TxSignatures -> String
$cshowList :: [TxSignatures] -> ShowS
showList :: [TxSignatures] -> ShowS
Show, (forall x. TxSignatures -> Rep TxSignatures x)
-> (forall x. Rep TxSignatures x -> TxSignatures)
-> Generic TxSignatures
forall x. Rep TxSignatures x -> TxSignatures
forall x. TxSignatures -> Rep TxSignatures x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TxSignatures -> Rep TxSignatures x
from :: forall x. TxSignatures -> Rep TxSignatures x
$cto :: forall x. Rep TxSignatures x -> TxSignatures
to :: forall x. Rep TxSignatures x -> TxSignatures
Generic)

instance NFData TxSignatures

-- | The tx_init_rbf message (type 72).
--
-- Initiates a replacement of the transaction after it's been completed.
data TxInitRbf = TxInitRbf
  { TxInitRbf -> ChannelId
txInitRbfChannelId :: !ChannelId
  , TxInitRbf -> Word32
txInitRbfLocktime  :: {-# UNPACK #-} !Word32
  , TxInitRbf -> Word32
txInitRbfFeerate   :: {-# UNPACK #-} !Word32
  , TxInitRbf -> TlvStream
txInitRbfTlvs      :: !TlvStream
  } deriving stock (TxInitRbf -> TxInitRbf -> Bool
(TxInitRbf -> TxInitRbf -> Bool)
-> (TxInitRbf -> TxInitRbf -> Bool) -> Eq TxInitRbf
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TxInitRbf -> TxInitRbf -> Bool
== :: TxInitRbf -> TxInitRbf -> Bool
$c/= :: TxInitRbf -> TxInitRbf -> Bool
/= :: TxInitRbf -> TxInitRbf -> Bool
Eq, Int -> TxInitRbf -> ShowS
[TxInitRbf] -> ShowS
TxInitRbf -> String
(Int -> TxInitRbf -> ShowS)
-> (TxInitRbf -> String)
-> ([TxInitRbf] -> ShowS)
-> Show TxInitRbf
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TxInitRbf -> ShowS
showsPrec :: Int -> TxInitRbf -> ShowS
$cshow :: TxInitRbf -> String
show :: TxInitRbf -> String
$cshowList :: [TxInitRbf] -> ShowS
showList :: [TxInitRbf] -> ShowS
Show, (forall x. TxInitRbf -> Rep TxInitRbf x)
-> (forall x. Rep TxInitRbf x -> TxInitRbf) -> Generic TxInitRbf
forall x. Rep TxInitRbf x -> TxInitRbf
forall x. TxInitRbf -> Rep TxInitRbf x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TxInitRbf -> Rep TxInitRbf x
from :: forall x. TxInitRbf -> Rep TxInitRbf x
$cto :: forall x. Rep TxInitRbf x -> TxInitRbf
to :: forall x. Rep TxInitRbf x -> TxInitRbf
Generic)

instance NFData TxInitRbf

-- | The tx_ack_rbf message (type 73).
--
-- Acknowledges an RBF attempt.
data TxAckRbf = TxAckRbf
  { TxAckRbf -> ChannelId
txAckRbfChannelId :: !ChannelId
  , TxAckRbf -> TlvStream
txAckRbfTlvs      :: !TlvStream
  } deriving stock (TxAckRbf -> TxAckRbf -> Bool
(TxAckRbf -> TxAckRbf -> Bool)
-> (TxAckRbf -> TxAckRbf -> Bool) -> Eq TxAckRbf
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TxAckRbf -> TxAckRbf -> Bool
== :: TxAckRbf -> TxAckRbf -> Bool
$c/= :: TxAckRbf -> TxAckRbf -> Bool
/= :: TxAckRbf -> TxAckRbf -> Bool
Eq, Int -> TxAckRbf -> ShowS
[TxAckRbf] -> ShowS
TxAckRbf -> String
(Int -> TxAckRbf -> ShowS)
-> (TxAckRbf -> String) -> ([TxAckRbf] -> ShowS) -> Show TxAckRbf
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TxAckRbf -> ShowS
showsPrec :: Int -> TxAckRbf -> ShowS
$cshow :: TxAckRbf -> String
show :: TxAckRbf -> String
$cshowList :: [TxAckRbf] -> ShowS
showList :: [TxAckRbf] -> ShowS
Show, (forall x. TxAckRbf -> Rep TxAckRbf x)
-> (forall x. Rep TxAckRbf x -> TxAckRbf) -> Generic TxAckRbf
forall x. Rep TxAckRbf x -> TxAckRbf
forall x. TxAckRbf -> Rep TxAckRbf x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TxAckRbf -> Rep TxAckRbf x
from :: forall x. TxAckRbf -> Rep TxAckRbf x
$cto :: forall x. Rep TxAckRbf x -> TxAckRbf
to :: forall x. Rep TxAckRbf x -> TxAckRbf
Generic)

instance NFData TxAckRbf

-- | The tx_abort message (type 74).
--
-- Aborts the collaborative transaction negotiation.
data TxAbort = TxAbort
  { TxAbort -> ChannelId
txAbortChannelId :: !ChannelId
  , TxAbort -> ByteString
txAbortData      :: !BS.ByteString
  } deriving stock (TxAbort -> TxAbort -> Bool
(TxAbort -> TxAbort -> Bool)
-> (TxAbort -> TxAbort -> Bool) -> Eq TxAbort
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TxAbort -> TxAbort -> Bool
== :: TxAbort -> TxAbort -> Bool
$c/= :: TxAbort -> TxAbort -> Bool
/= :: TxAbort -> TxAbort -> Bool
Eq, Int -> TxAbort -> ShowS
[TxAbort] -> ShowS
TxAbort -> String
(Int -> TxAbort -> ShowS)
-> (TxAbort -> String) -> ([TxAbort] -> ShowS) -> Show TxAbort
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TxAbort -> ShowS
showsPrec :: Int -> TxAbort -> ShowS
$cshow :: TxAbort -> String
show :: TxAbort -> String
$cshowList :: [TxAbort] -> ShowS
showList :: [TxAbort] -> ShowS
Show, (forall x. TxAbort -> Rep TxAbort x)
-> (forall x. Rep TxAbort x -> TxAbort) -> Generic TxAbort
forall x. Rep TxAbort x -> TxAbort
forall x. TxAbort -> Rep TxAbort x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TxAbort -> Rep TxAbort x
from :: forall x. TxAbort -> Rep TxAbort x
$cto :: forall x. Rep TxAbort x -> TxAbort
to :: forall x. Rep TxAbort x -> TxAbort
Generic)

instance NFData TxAbort

-- Channel close ---------------------------------------------------------------

-- | The stfu message (type 2).
--
-- Indicates "SomeThing Fundamental is Underway" - used for channel
-- quiescence.
data Stfu = Stfu
  { Stfu -> ChannelId
stfuChannelId :: !ChannelId
  , Stfu -> Word8
stfuInitiator :: {-# UNPACK #-} !Word8
  } deriving stock (Stfu -> Stfu -> Bool
(Stfu -> Stfu -> Bool) -> (Stfu -> Stfu -> Bool) -> Eq Stfu
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Stfu -> Stfu -> Bool
== :: Stfu -> Stfu -> Bool
$c/= :: Stfu -> Stfu -> Bool
/= :: Stfu -> Stfu -> Bool
Eq, Int -> Stfu -> ShowS
[Stfu] -> ShowS
Stfu -> String
(Int -> Stfu -> ShowS)
-> (Stfu -> String) -> ([Stfu] -> ShowS) -> Show Stfu
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Stfu -> ShowS
showsPrec :: Int -> Stfu -> ShowS
$cshow :: Stfu -> String
show :: Stfu -> String
$cshowList :: [Stfu] -> ShowS
showList :: [Stfu] -> ShowS
Show, (forall x. Stfu -> Rep Stfu x)
-> (forall x. Rep Stfu x -> Stfu) -> Generic Stfu
forall x. Rep Stfu x -> Stfu
forall x. Stfu -> Rep Stfu x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Stfu -> Rep Stfu x
from :: forall x. Stfu -> Rep Stfu x
$cto :: forall x. Rep Stfu x -> Stfu
to :: forall x. Rep Stfu x -> Stfu
Generic)

instance NFData Stfu

-- | The shutdown message (type 38).
--
-- Initiates closing of the channel.
data Shutdown = Shutdown
  { Shutdown -> ChannelId
shutdownChannelId    :: !ChannelId
  , Shutdown -> ScriptPubKey
shutdownScriptPubkey :: !ScriptPubKey
  } deriving stock (Shutdown -> Shutdown -> Bool
(Shutdown -> Shutdown -> Bool)
-> (Shutdown -> Shutdown -> Bool) -> Eq Shutdown
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Shutdown -> Shutdown -> Bool
== :: Shutdown -> Shutdown -> Bool
$c/= :: Shutdown -> Shutdown -> Bool
/= :: Shutdown -> Shutdown -> Bool
Eq, Int -> Shutdown -> ShowS
[Shutdown] -> ShowS
Shutdown -> String
(Int -> Shutdown -> ShowS)
-> (Shutdown -> String) -> ([Shutdown] -> ShowS) -> Show Shutdown
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Shutdown -> ShowS
showsPrec :: Int -> Shutdown -> ShowS
$cshow :: Shutdown -> String
show :: Shutdown -> String
$cshowList :: [Shutdown] -> ShowS
showList :: [Shutdown] -> ShowS
Show, (forall x. Shutdown -> Rep Shutdown x)
-> (forall x. Rep Shutdown x -> Shutdown) -> Generic Shutdown
forall x. Rep Shutdown x -> Shutdown
forall x. Shutdown -> Rep Shutdown x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Shutdown -> Rep Shutdown x
from :: forall x. Shutdown -> Rep Shutdown x
$cto :: forall x. Rep Shutdown x -> Shutdown
to :: forall x. Rep Shutdown x -> Shutdown
Generic)

instance NFData Shutdown

-- | The closing_signed message (type 39).
--
-- Used in legacy closing negotiation.
data ClosingSigned = ClosingSigned
  { ClosingSigned -> ChannelId
closingSignedChannelId   :: !ChannelId
  , ClosingSigned -> Satoshis
closingSignedFeeSatoshis :: {-# UNPACK #-} !Satoshis
  , ClosingSigned -> Signature
closingSignedSignature   :: !Signature
  , ClosingSigned -> TlvStream
closingSignedTlvs        :: !TlvStream
  } deriving stock (ClosingSigned -> ClosingSigned -> Bool
(ClosingSigned -> ClosingSigned -> Bool)
-> (ClosingSigned -> ClosingSigned -> Bool) -> Eq ClosingSigned
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ClosingSigned -> ClosingSigned -> Bool
== :: ClosingSigned -> ClosingSigned -> Bool
$c/= :: ClosingSigned -> ClosingSigned -> Bool
/= :: ClosingSigned -> ClosingSigned -> Bool
Eq, Int -> ClosingSigned -> ShowS
[ClosingSigned] -> ShowS
ClosingSigned -> String
(Int -> ClosingSigned -> ShowS)
-> (ClosingSigned -> String)
-> ([ClosingSigned] -> ShowS)
-> Show ClosingSigned
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ClosingSigned -> ShowS
showsPrec :: Int -> ClosingSigned -> ShowS
$cshow :: ClosingSigned -> String
show :: ClosingSigned -> String
$cshowList :: [ClosingSigned] -> ShowS
showList :: [ClosingSigned] -> ShowS
Show, (forall x. ClosingSigned -> Rep ClosingSigned x)
-> (forall x. Rep ClosingSigned x -> ClosingSigned)
-> Generic ClosingSigned
forall x. Rep ClosingSigned x -> ClosingSigned
forall x. ClosingSigned -> Rep ClosingSigned x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ClosingSigned -> Rep ClosingSigned x
from :: forall x. ClosingSigned -> Rep ClosingSigned x
$cto :: forall x. Rep ClosingSigned x -> ClosingSigned
to :: forall x. Rep ClosingSigned x -> ClosingSigned
Generic)

instance NFData ClosingSigned

-- | The closing_complete message (type 40).
--
-- Proposes a closing transaction in the new closing protocol.
data ClosingComplete = ClosingComplete
  { ClosingComplete -> ChannelId
closingCompleteChannelId       :: !ChannelId
  , ClosingComplete -> ScriptPubKey
closingCompleteCloserScript    :: !ScriptPubKey
  , ClosingComplete -> ScriptPubKey
closingCompleteCloseeScript    :: !ScriptPubKey
  , ClosingComplete -> Satoshis
closingCompleteFeeSatoshis     :: {-# UNPACK #-} !Satoshis
  , ClosingComplete -> Word32
closingCompleteLocktime        :: {-# UNPACK #-} !Word32
  , ClosingComplete -> TlvStream
closingCompleteTlvs            :: !TlvStream
  } deriving stock (ClosingComplete -> ClosingComplete -> Bool
(ClosingComplete -> ClosingComplete -> Bool)
-> (ClosingComplete -> ClosingComplete -> Bool)
-> Eq ClosingComplete
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ClosingComplete -> ClosingComplete -> Bool
== :: ClosingComplete -> ClosingComplete -> Bool
$c/= :: ClosingComplete -> ClosingComplete -> Bool
/= :: ClosingComplete -> ClosingComplete -> Bool
Eq, Int -> ClosingComplete -> ShowS
[ClosingComplete] -> ShowS
ClosingComplete -> String
(Int -> ClosingComplete -> ShowS)
-> (ClosingComplete -> String)
-> ([ClosingComplete] -> ShowS)
-> Show ClosingComplete
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ClosingComplete -> ShowS
showsPrec :: Int -> ClosingComplete -> ShowS
$cshow :: ClosingComplete -> String
show :: ClosingComplete -> String
$cshowList :: [ClosingComplete] -> ShowS
showList :: [ClosingComplete] -> ShowS
Show, (forall x. ClosingComplete -> Rep ClosingComplete x)
-> (forall x. Rep ClosingComplete x -> ClosingComplete)
-> Generic ClosingComplete
forall x. Rep ClosingComplete x -> ClosingComplete
forall x. ClosingComplete -> Rep ClosingComplete x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ClosingComplete -> Rep ClosingComplete x
from :: forall x. ClosingComplete -> Rep ClosingComplete x
$cto :: forall x. Rep ClosingComplete x -> ClosingComplete
to :: forall x. Rep ClosingComplete x -> ClosingComplete
Generic)

instance NFData ClosingComplete

-- | The closing_sig message (type 41).
--
-- Signs a closing transaction in the new closing protocol.
data ClosingSig = ClosingSig
  { ClosingSig -> ChannelId
closingSigChannelId       :: !ChannelId
  , ClosingSig -> ScriptPubKey
closingSigCloserScript    :: !ScriptPubKey
  , ClosingSig -> ScriptPubKey
closingSigCloseeScript    :: !ScriptPubKey
  , ClosingSig -> Satoshis
closingSigFeeSatoshis     :: {-# UNPACK #-} !Satoshis
  , ClosingSig -> Word32
closingSigLocktime        :: {-# UNPACK #-} !Word32
  , ClosingSig -> TlvStream
closingSigTlvs            :: !TlvStream
  } deriving stock (ClosingSig -> ClosingSig -> Bool
(ClosingSig -> ClosingSig -> Bool)
-> (ClosingSig -> ClosingSig -> Bool) -> Eq ClosingSig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ClosingSig -> ClosingSig -> Bool
== :: ClosingSig -> ClosingSig -> Bool
$c/= :: ClosingSig -> ClosingSig -> Bool
/= :: ClosingSig -> ClosingSig -> Bool
Eq, Int -> ClosingSig -> ShowS
[ClosingSig] -> ShowS
ClosingSig -> String
(Int -> ClosingSig -> ShowS)
-> (ClosingSig -> String)
-> ([ClosingSig] -> ShowS)
-> Show ClosingSig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ClosingSig -> ShowS
showsPrec :: Int -> ClosingSig -> ShowS
$cshow :: ClosingSig -> String
show :: ClosingSig -> String
$cshowList :: [ClosingSig] -> ShowS
showList :: [ClosingSig] -> ShowS
Show, (forall x. ClosingSig -> Rep ClosingSig x)
-> (forall x. Rep ClosingSig x -> ClosingSig) -> Generic ClosingSig
forall x. Rep ClosingSig x -> ClosingSig
forall x. ClosingSig -> Rep ClosingSig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ClosingSig -> Rep ClosingSig x
from :: forall x. ClosingSig -> Rep ClosingSig x
$cto :: forall x. Rep ClosingSig x -> ClosingSig
to :: forall x. Rep ClosingSig x -> ClosingSig
Generic)

instance NFData ClosingSig

-- Normal operation ------------------------------------------------------------

-- | The update_add_htlc message (type 128).
--
-- Offers an HTLC to the other node, redeemable in return for a payment
-- preimage.
data UpdateAddHtlc = UpdateAddHtlc
  { UpdateAddHtlc -> ChannelId
updateAddHtlcChannelId       :: !ChannelId
  , UpdateAddHtlc -> Word64
updateAddHtlcId              :: {-# UNPACK #-} !Word64
  , UpdateAddHtlc -> MilliSatoshis
updateAddHtlcAmountMsat      :: {-# UNPACK #-} !MilliSatoshis
  , UpdateAddHtlc -> PaymentHash
updateAddHtlcPaymentHash     :: !PaymentHash
  , UpdateAddHtlc -> Word32
updateAddHtlcCltvExpiry      :: {-# UNPACK #-} !Word32
  , UpdateAddHtlc -> OnionPacket
updateAddHtlcOnionPacket     :: !OnionPacket
  , UpdateAddHtlc -> TlvStream
updateAddHtlcTlvs            :: !TlvStream
  } deriving stock (UpdateAddHtlc -> UpdateAddHtlc -> Bool
(UpdateAddHtlc -> UpdateAddHtlc -> Bool)
-> (UpdateAddHtlc -> UpdateAddHtlc -> Bool) -> Eq UpdateAddHtlc
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UpdateAddHtlc -> UpdateAddHtlc -> Bool
== :: UpdateAddHtlc -> UpdateAddHtlc -> Bool
$c/= :: UpdateAddHtlc -> UpdateAddHtlc -> Bool
/= :: UpdateAddHtlc -> UpdateAddHtlc -> Bool
Eq, Int -> UpdateAddHtlc -> ShowS
[UpdateAddHtlc] -> ShowS
UpdateAddHtlc -> String
(Int -> UpdateAddHtlc -> ShowS)
-> (UpdateAddHtlc -> String)
-> ([UpdateAddHtlc] -> ShowS)
-> Show UpdateAddHtlc
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UpdateAddHtlc -> ShowS
showsPrec :: Int -> UpdateAddHtlc -> ShowS
$cshow :: UpdateAddHtlc -> String
show :: UpdateAddHtlc -> String
$cshowList :: [UpdateAddHtlc] -> ShowS
showList :: [UpdateAddHtlc] -> ShowS
Show, (forall x. UpdateAddHtlc -> Rep UpdateAddHtlc x)
-> (forall x. Rep UpdateAddHtlc x -> UpdateAddHtlc)
-> Generic UpdateAddHtlc
forall x. Rep UpdateAddHtlc x -> UpdateAddHtlc
forall x. UpdateAddHtlc -> Rep UpdateAddHtlc x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. UpdateAddHtlc -> Rep UpdateAddHtlc x
from :: forall x. UpdateAddHtlc -> Rep UpdateAddHtlc x
$cto :: forall x. Rep UpdateAddHtlc x -> UpdateAddHtlc
to :: forall x. Rep UpdateAddHtlc x -> UpdateAddHtlc
Generic)

instance NFData UpdateAddHtlc

-- | The update_fulfill_htlc message (type 130).
--
-- Supplies the preimage to fulfill an HTLC.
data UpdateFulfillHtlc = UpdateFulfillHtlc
  { UpdateFulfillHtlc -> ChannelId
updateFulfillHtlcChannelId       :: !ChannelId
  , UpdateFulfillHtlc -> Word64
updateFulfillHtlcId              :: {-# UNPACK #-} !Word64
  , UpdateFulfillHtlc -> PaymentPreimage
updateFulfillHtlcPaymentPreimage :: !PaymentPreimage
  , UpdateFulfillHtlc -> TlvStream
updateFulfillHtlcTlvs            :: !TlvStream
  } deriving stock (UpdateFulfillHtlc -> UpdateFulfillHtlc -> Bool
(UpdateFulfillHtlc -> UpdateFulfillHtlc -> Bool)
-> (UpdateFulfillHtlc -> UpdateFulfillHtlc -> Bool)
-> Eq UpdateFulfillHtlc
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UpdateFulfillHtlc -> UpdateFulfillHtlc -> Bool
== :: UpdateFulfillHtlc -> UpdateFulfillHtlc -> Bool
$c/= :: UpdateFulfillHtlc -> UpdateFulfillHtlc -> Bool
/= :: UpdateFulfillHtlc -> UpdateFulfillHtlc -> Bool
Eq, Int -> UpdateFulfillHtlc -> ShowS
[UpdateFulfillHtlc] -> ShowS
UpdateFulfillHtlc -> String
(Int -> UpdateFulfillHtlc -> ShowS)
-> (UpdateFulfillHtlc -> String)
-> ([UpdateFulfillHtlc] -> ShowS)
-> Show UpdateFulfillHtlc
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UpdateFulfillHtlc -> ShowS
showsPrec :: Int -> UpdateFulfillHtlc -> ShowS
$cshow :: UpdateFulfillHtlc -> String
show :: UpdateFulfillHtlc -> String
$cshowList :: [UpdateFulfillHtlc] -> ShowS
showList :: [UpdateFulfillHtlc] -> ShowS
Show, (forall x. UpdateFulfillHtlc -> Rep UpdateFulfillHtlc x)
-> (forall x. Rep UpdateFulfillHtlc x -> UpdateFulfillHtlc)
-> Generic UpdateFulfillHtlc
forall x. Rep UpdateFulfillHtlc x -> UpdateFulfillHtlc
forall x. UpdateFulfillHtlc -> Rep UpdateFulfillHtlc x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. UpdateFulfillHtlc -> Rep UpdateFulfillHtlc x
from :: forall x. UpdateFulfillHtlc -> Rep UpdateFulfillHtlc x
$cto :: forall x. Rep UpdateFulfillHtlc x -> UpdateFulfillHtlc
to :: forall x. Rep UpdateFulfillHtlc x -> UpdateFulfillHtlc
Generic)

instance NFData UpdateFulfillHtlc

-- | The update_fail_htlc message (type 131).
--
-- Indicates an HTLC has failed.
data UpdateFailHtlc = UpdateFailHtlc
  { UpdateFailHtlc -> ChannelId
updateFailHtlcChannelId :: !ChannelId
  , UpdateFailHtlc -> Word64
updateFailHtlcId        :: {-# UNPACK #-} !Word64
  , UpdateFailHtlc -> ByteString
updateFailHtlcReason    :: !BS.ByteString
  , UpdateFailHtlc -> TlvStream
updateFailHtlcTlvs      :: !TlvStream
  } deriving stock (UpdateFailHtlc -> UpdateFailHtlc -> Bool
(UpdateFailHtlc -> UpdateFailHtlc -> Bool)
-> (UpdateFailHtlc -> UpdateFailHtlc -> Bool) -> Eq UpdateFailHtlc
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UpdateFailHtlc -> UpdateFailHtlc -> Bool
== :: UpdateFailHtlc -> UpdateFailHtlc -> Bool
$c/= :: UpdateFailHtlc -> UpdateFailHtlc -> Bool
/= :: UpdateFailHtlc -> UpdateFailHtlc -> Bool
Eq, Int -> UpdateFailHtlc -> ShowS
[UpdateFailHtlc] -> ShowS
UpdateFailHtlc -> String
(Int -> UpdateFailHtlc -> ShowS)
-> (UpdateFailHtlc -> String)
-> ([UpdateFailHtlc] -> ShowS)
-> Show UpdateFailHtlc
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UpdateFailHtlc -> ShowS
showsPrec :: Int -> UpdateFailHtlc -> ShowS
$cshow :: UpdateFailHtlc -> String
show :: UpdateFailHtlc -> String
$cshowList :: [UpdateFailHtlc] -> ShowS
showList :: [UpdateFailHtlc] -> ShowS
Show, (forall x. UpdateFailHtlc -> Rep UpdateFailHtlc x)
-> (forall x. Rep UpdateFailHtlc x -> UpdateFailHtlc)
-> Generic UpdateFailHtlc
forall x. Rep UpdateFailHtlc x -> UpdateFailHtlc
forall x. UpdateFailHtlc -> Rep UpdateFailHtlc x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. UpdateFailHtlc -> Rep UpdateFailHtlc x
from :: forall x. UpdateFailHtlc -> Rep UpdateFailHtlc x
$cto :: forall x. Rep UpdateFailHtlc x -> UpdateFailHtlc
to :: forall x. Rep UpdateFailHtlc x -> UpdateFailHtlc
Generic)

instance NFData UpdateFailHtlc

-- | The update_fail_malformed_htlc message (type 135).
--
-- Indicates an HTLC could not be parsed.
data UpdateFailMalformedHtlc = UpdateFailMalformedHtlc
  { UpdateFailMalformedHtlc -> ChannelId
updateFailMalformedHtlcChannelId   :: !ChannelId
  , UpdateFailMalformedHtlc -> Word64
updateFailMalformedHtlcId          :: {-# UNPACK #-} !Word64
  , UpdateFailMalformedHtlc -> PaymentHash
updateFailMalformedHtlcSha256Onion :: !PaymentHash
  , UpdateFailMalformedHtlc -> Word16
updateFailMalformedHtlcFailureCode :: {-# UNPACK #-} !Word16
  } deriving stock (UpdateFailMalformedHtlc -> UpdateFailMalformedHtlc -> Bool
(UpdateFailMalformedHtlc -> UpdateFailMalformedHtlc -> Bool)
-> (UpdateFailMalformedHtlc -> UpdateFailMalformedHtlc -> Bool)
-> Eq UpdateFailMalformedHtlc
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UpdateFailMalformedHtlc -> UpdateFailMalformedHtlc -> Bool
== :: UpdateFailMalformedHtlc -> UpdateFailMalformedHtlc -> Bool
$c/= :: UpdateFailMalformedHtlc -> UpdateFailMalformedHtlc -> Bool
/= :: UpdateFailMalformedHtlc -> UpdateFailMalformedHtlc -> Bool
Eq, Int -> UpdateFailMalformedHtlc -> ShowS
[UpdateFailMalformedHtlc] -> ShowS
UpdateFailMalformedHtlc -> String
(Int -> UpdateFailMalformedHtlc -> ShowS)
-> (UpdateFailMalformedHtlc -> String)
-> ([UpdateFailMalformedHtlc] -> ShowS)
-> Show UpdateFailMalformedHtlc
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UpdateFailMalformedHtlc -> ShowS
showsPrec :: Int -> UpdateFailMalformedHtlc -> ShowS
$cshow :: UpdateFailMalformedHtlc -> String
show :: UpdateFailMalformedHtlc -> String
$cshowList :: [UpdateFailMalformedHtlc] -> ShowS
showList :: [UpdateFailMalformedHtlc] -> ShowS
Show, (forall x.
 UpdateFailMalformedHtlc -> Rep UpdateFailMalformedHtlc x)
-> (forall x.
    Rep UpdateFailMalformedHtlc x -> UpdateFailMalformedHtlc)
-> Generic UpdateFailMalformedHtlc
forall x. Rep UpdateFailMalformedHtlc x -> UpdateFailMalformedHtlc
forall x. UpdateFailMalformedHtlc -> Rep UpdateFailMalformedHtlc x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. UpdateFailMalformedHtlc -> Rep UpdateFailMalformedHtlc x
from :: forall x. UpdateFailMalformedHtlc -> Rep UpdateFailMalformedHtlc x
$cto :: forall x. Rep UpdateFailMalformedHtlc x -> UpdateFailMalformedHtlc
to :: forall x. Rep UpdateFailMalformedHtlc x -> UpdateFailMalformedHtlc
Generic)

instance NFData UpdateFailMalformedHtlc

-- | The commitment_signed message (type 132).
--
-- Applies pending changes and provides signatures for the commitment
-- transaction.
data CommitmentSigned = CommitmentSigned
  { CommitmentSigned -> ChannelId
commitmentSignedChannelId      :: !ChannelId
  , CommitmentSigned -> Signature
commitmentSignedSignature      :: !Signature
  , CommitmentSigned -> [Signature]
commitmentSignedHtlcSignatures :: ![Signature]
  } deriving stock (CommitmentSigned -> CommitmentSigned -> Bool
(CommitmentSigned -> CommitmentSigned -> Bool)
-> (CommitmentSigned -> CommitmentSigned -> Bool)
-> Eq CommitmentSigned
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CommitmentSigned -> CommitmentSigned -> Bool
== :: CommitmentSigned -> CommitmentSigned -> Bool
$c/= :: CommitmentSigned -> CommitmentSigned -> Bool
/= :: CommitmentSigned -> CommitmentSigned -> Bool
Eq, Int -> CommitmentSigned -> ShowS
[CommitmentSigned] -> ShowS
CommitmentSigned -> String
(Int -> CommitmentSigned -> ShowS)
-> (CommitmentSigned -> String)
-> ([CommitmentSigned] -> ShowS)
-> Show CommitmentSigned
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CommitmentSigned -> ShowS
showsPrec :: Int -> CommitmentSigned -> ShowS
$cshow :: CommitmentSigned -> String
show :: CommitmentSigned -> String
$cshowList :: [CommitmentSigned] -> ShowS
showList :: [CommitmentSigned] -> ShowS
Show, (forall x. CommitmentSigned -> Rep CommitmentSigned x)
-> (forall x. Rep CommitmentSigned x -> CommitmentSigned)
-> Generic CommitmentSigned
forall x. Rep CommitmentSigned x -> CommitmentSigned
forall x. CommitmentSigned -> Rep CommitmentSigned x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CommitmentSigned -> Rep CommitmentSigned x
from :: forall x. CommitmentSigned -> Rep CommitmentSigned x
$cto :: forall x. Rep CommitmentSigned x -> CommitmentSigned
to :: forall x. Rep CommitmentSigned x -> CommitmentSigned
Generic)

instance NFData CommitmentSigned

-- | The revoke_and_ack message (type 133).
--
-- Revokes the previous commitment transaction and acknowledges receipt
-- of the commitment_signed.
data RevokeAndAck = RevokeAndAck
  { RevokeAndAck -> ChannelId
revokeAndAckChannelId             :: !ChannelId
  , RevokeAndAck -> Secret
revokeAndAckPerCommitmentSecret   :: !Secret
  , RevokeAndAck -> Point
revokeAndAckNextPerCommitPoint    :: !Point
  } deriving stock (RevokeAndAck -> RevokeAndAck -> Bool
(RevokeAndAck -> RevokeAndAck -> Bool)
-> (RevokeAndAck -> RevokeAndAck -> Bool) -> Eq RevokeAndAck
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RevokeAndAck -> RevokeAndAck -> Bool
== :: RevokeAndAck -> RevokeAndAck -> Bool
$c/= :: RevokeAndAck -> RevokeAndAck -> Bool
/= :: RevokeAndAck -> RevokeAndAck -> Bool
Eq, Int -> RevokeAndAck -> ShowS
[RevokeAndAck] -> ShowS
RevokeAndAck -> String
(Int -> RevokeAndAck -> ShowS)
-> (RevokeAndAck -> String)
-> ([RevokeAndAck] -> ShowS)
-> Show RevokeAndAck
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RevokeAndAck -> ShowS
showsPrec :: Int -> RevokeAndAck -> ShowS
$cshow :: RevokeAndAck -> String
show :: RevokeAndAck -> String
$cshowList :: [RevokeAndAck] -> ShowS
showList :: [RevokeAndAck] -> ShowS
Show, (forall x. RevokeAndAck -> Rep RevokeAndAck x)
-> (forall x. Rep RevokeAndAck x -> RevokeAndAck)
-> Generic RevokeAndAck
forall x. Rep RevokeAndAck x -> RevokeAndAck
forall x. RevokeAndAck -> Rep RevokeAndAck x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. RevokeAndAck -> Rep RevokeAndAck x
from :: forall x. RevokeAndAck -> Rep RevokeAndAck x
$cto :: forall x. Rep RevokeAndAck x -> RevokeAndAck
to :: forall x. Rep RevokeAndAck x -> RevokeAndAck
Generic)

instance NFData RevokeAndAck

-- | The update_fee message (type 134).
--
-- Updates the fee rate for commitment transactions.
data UpdateFee = UpdateFee
  { UpdateFee -> ChannelId
updateFeeChannelId    :: !ChannelId
  , UpdateFee -> Word32
updateFeeFeeratePerKw :: {-# UNPACK #-} !Word32
  } deriving stock (UpdateFee -> UpdateFee -> Bool
(UpdateFee -> UpdateFee -> Bool)
-> (UpdateFee -> UpdateFee -> Bool) -> Eq UpdateFee
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UpdateFee -> UpdateFee -> Bool
== :: UpdateFee -> UpdateFee -> Bool
$c/= :: UpdateFee -> UpdateFee -> Bool
/= :: UpdateFee -> UpdateFee -> Bool
Eq, Int -> UpdateFee -> ShowS
[UpdateFee] -> ShowS
UpdateFee -> String
(Int -> UpdateFee -> ShowS)
-> (UpdateFee -> String)
-> ([UpdateFee] -> ShowS)
-> Show UpdateFee
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UpdateFee -> ShowS
showsPrec :: Int -> UpdateFee -> ShowS
$cshow :: UpdateFee -> String
show :: UpdateFee -> String
$cshowList :: [UpdateFee] -> ShowS
showList :: [UpdateFee] -> ShowS
Show, (forall x. UpdateFee -> Rep UpdateFee x)
-> (forall x. Rep UpdateFee x -> UpdateFee) -> Generic UpdateFee
forall x. Rep UpdateFee x -> UpdateFee
forall x. UpdateFee -> Rep UpdateFee x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. UpdateFee -> Rep UpdateFee x
from :: forall x. UpdateFee -> Rep UpdateFee x
$cto :: forall x. Rep UpdateFee x -> UpdateFee
to :: forall x. Rep UpdateFee x -> UpdateFee
Generic)

instance NFData UpdateFee

-- Reestablishment -------------------------------------------------------------

-- | The channel_reestablish message (type 136).
--
-- Used to re-establish a channel after reconnection.
data ChannelReestablish = ChannelReestablish
  { ChannelReestablish -> ChannelId
channelReestablishChannelId            :: !ChannelId
  , ChannelReestablish -> Word64
channelReestablishNextCommitNum        :: {-# UNPACK #-} !Word64
  , ChannelReestablish -> Word64
channelReestablishNextRevocationNum    :: {-# UNPACK #-} !Word64
  , ChannelReestablish -> Secret
channelReestablishYourLastCommitSecret :: !Secret
  , ChannelReestablish -> Point
channelReestablishMyCurrentCommitPoint :: !Point
  , ChannelReestablish -> TlvStream
channelReestablishTlvs                 :: !TlvStream
  } deriving stock (ChannelReestablish -> ChannelReestablish -> Bool
(ChannelReestablish -> ChannelReestablish -> Bool)
-> (ChannelReestablish -> ChannelReestablish -> Bool)
-> Eq ChannelReestablish
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ChannelReestablish -> ChannelReestablish -> Bool
== :: ChannelReestablish -> ChannelReestablish -> Bool
$c/= :: ChannelReestablish -> ChannelReestablish -> Bool
/= :: ChannelReestablish -> ChannelReestablish -> Bool
Eq, Int -> ChannelReestablish -> ShowS
[ChannelReestablish] -> ShowS
ChannelReestablish -> String
(Int -> ChannelReestablish -> ShowS)
-> (ChannelReestablish -> String)
-> ([ChannelReestablish] -> ShowS)
-> Show ChannelReestablish
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ChannelReestablish -> ShowS
showsPrec :: Int -> ChannelReestablish -> ShowS
$cshow :: ChannelReestablish -> String
show :: ChannelReestablish -> String
$cshowList :: [ChannelReestablish] -> ShowS
showList :: [ChannelReestablish] -> ShowS
Show, (forall x. ChannelReestablish -> Rep ChannelReestablish x)
-> (forall x. Rep ChannelReestablish x -> ChannelReestablish)
-> Generic ChannelReestablish
forall x. Rep ChannelReestablish x -> ChannelReestablish
forall x. ChannelReestablish -> Rep ChannelReestablish x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ChannelReestablish -> Rep ChannelReestablish x
from :: forall x. ChannelReestablish -> Rep ChannelReestablish x
$cto :: forall x. Rep ChannelReestablish x -> ChannelReestablish
to :: forall x. Rep ChannelReestablish x -> ChannelReestablish
Generic)

instance NFData ChannelReestablish

-- Top-level message type ------------------------------------------------------

-- | All BOLT #2 messages.
data Message
  -- Channel establishment v1
  = MsgOpenChannelVal !OpenChannel
  | MsgAcceptChannelVal !AcceptChannel
  | MsgFundingCreatedVal !FundingCreated
  | MsgFundingSignedVal !FundingSigned
  | MsgChannelReadyVal !ChannelReady
  -- Channel establishment v2
  | MsgOpenChannel2Val !OpenChannel2
  | MsgAcceptChannel2Val !AcceptChannel2
  | MsgTxAddInputVal !TxAddInput
  | MsgTxAddOutputVal !TxAddOutput
  | MsgTxRemoveInputVal !TxRemoveInput
  | MsgTxRemoveOutputVal !TxRemoveOutput
  | MsgTxCompleteVal !TxComplete
  | MsgTxSignaturesVal !TxSignatures
  | MsgTxInitRbfVal !TxInitRbf
  | MsgTxAckRbfVal !TxAckRbf
  | MsgTxAbortVal !TxAbort
  -- Channel close
  | MsgStfuVal !Stfu
  | MsgShutdownVal !Shutdown
  | MsgClosingSignedVal !ClosingSigned
  | MsgClosingCompleteVal !ClosingComplete
  | MsgClosingSigVal !ClosingSig
  -- Normal operation
  | MsgUpdateAddHtlcVal !UpdateAddHtlc
  | MsgUpdateFulfillHtlcVal !UpdateFulfillHtlc
  | MsgUpdateFailHtlcVal !UpdateFailHtlc
  | MsgUpdateFailMalformedHtlcVal !UpdateFailMalformedHtlc
  | MsgCommitmentSignedVal !CommitmentSigned
  | MsgRevokeAndAckVal !RevokeAndAck
  | MsgUpdateFeeVal !UpdateFee
  -- Reestablishment
  | MsgChannelReestablishVal !ChannelReestablish
  deriving stock (Message -> Message -> Bool
(Message -> Message -> Bool)
-> (Message -> Message -> Bool) -> Eq Message
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Message -> Message -> Bool
== :: Message -> Message -> Bool
$c/= :: Message -> Message -> Bool
/= :: Message -> Message -> Bool
Eq, Int -> Message -> ShowS
[Message] -> ShowS
Message -> String
(Int -> Message -> ShowS)
-> (Message -> String) -> ([Message] -> ShowS) -> Show Message
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Message -> ShowS
showsPrec :: Int -> Message -> ShowS
$cshow :: Message -> String
show :: Message -> String
$cshowList :: [Message] -> ShowS
showList :: [Message] -> ShowS
Show, (forall x. Message -> Rep Message x)
-> (forall x. Rep Message x -> Message) -> Generic Message
forall x. Rep Message x -> Message
forall x. Message -> Rep Message x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Message -> Rep Message x
from :: forall x. Message -> Rep Message x
$cto :: forall x. Rep Message x -> Message
to :: forall x. Rep Message x -> Message
Generic)

instance NFData Message