{-# OPTIONS_HADDOCK hide #-}
{-# LANGUAGE DeriveGeneric #-}

-- |
-- Module: Lightning.Protocol.BOLT2.Messages
-- Copyright: (c) 2025 Jared Tobin
-- License: MIT
-- Maintainer: Jared Tobin <jared@ppad.tech>
--
-- The messages defined by BOLT #2.

module Lightning.Protocol.BOLT2.Messages (
    Message(..)
  , message_type

  , OpenChannel(..)
  , AcceptChannel(..)
  , FundingCreated(..)
  , FundingSigned(..)
  , ChannelReady(..)

  , OpenChannel2(..)
  , AcceptChannel2(..)
  , TxAddInput(..)
  , TxAddOutput(..)
  , TxRemoveInput(..)
  , TxRemoveOutput(..)
  , TxComplete(..)
  , TxSignatures(..)
  , TxInitRbf(..)
  , TxAckRbf(..)
  , TxAbort(..)

  , Stfu(..)

  , Shutdown(..)
  , ClosingComplete(..)
  , ClosingSig(..)
  , ClosingSigned(..)

  , UpdateAddHtlc(..)
  , UpdateFulfillHtlc(..)
  , UpdateFailHtlc(..)
  , UpdateFailMalformedHtlc(..)
  , CommitmentSigned(..)
  , RevokeAndAck(..)
  , UpdateFee(..)

  , ChannelReestablish(..)
  ) where

import Bitcoin.Prim.Tx (TxId)
import Control.DeepSeq (NFData)
import qualified Data.ByteString as BS
import Data.Int (Int64)
import Data.Word (Word8, Word16, Word32, Word64)
import GHC.Generics (Generic)
import Lightning.Protocol.BOLT1
  ( ChainHash, ChannelId, Signature, Point, PaymentHash, PaymentPreimage
  , PerCommitmentSecret, ShortChannelId, Satoshi, MilliSatoshi, TlvStream )
import qualified Lightning.Protocol.BOLT9 as BOLT9
import Lightning.Protocol.BOLT2.Types

-- channel establishment v1 ---------------------------------------------------

-- | The @open_channel@ message (type 32).
data OpenChannel = OpenChannel
  { OpenChannel -> ChainHash
open_channel_chain_hash                    :: !ChainHash
  , OpenChannel -> ChannelId
open_channel_temporary_channel_id          :: !ChannelId
  , OpenChannel -> Satoshi
open_channel_funding_satoshis              :: {-# UNPACK #-} !Satoshi
  , OpenChannel -> MilliSatoshi
open_channel_push_msat                     :: {-# UNPACK #-} !MilliSatoshi
  , OpenChannel -> Satoshi
open_channel_dust_limit_satoshis           :: {-# UNPACK #-} !Satoshi
  , OpenChannel -> Word64
open_channel_max_htlc_value_in_flight_msat :: {-# UNPACK #-} !Word64
    -- ^ a cap, often @maxBound@, so not a bounded amount
  , OpenChannel -> Satoshi
open_channel_channel_reserve_satoshis      :: {-# UNPACK #-} !Satoshi
  , OpenChannel -> MilliSatoshi
open_channel_htlc_minimum_msat             :: {-# UNPACK #-} !MilliSatoshi
  , OpenChannel -> Word32
open_channel_feerate_per_kw                :: {-# UNPACK #-} !Word32
  , OpenChannel -> Word16
open_channel_to_self_delay                 :: {-# UNPACK #-} !Word16
  , OpenChannel -> Word16
open_channel_max_accepted_htlcs            :: {-# UNPACK #-} !Word16
  , OpenChannel -> Point
open_channel_funding_pubkey                :: !Point
  , OpenChannel -> Point
open_channel_revocation_basepoint          :: !Point
  , OpenChannel -> Point
open_channel_payment_basepoint             :: !Point
  , OpenChannel -> Point
open_channel_delayed_payment_basepoint     :: !Point
  , OpenChannel -> Point
open_channel_htlc_basepoint                :: !Point
  , OpenChannel -> Point
open_channel_first_per_commitment_point    :: !Point
  , OpenChannel -> Word8
open_channel_channel_flags                 :: {-# UNPACK #-} !Word8
    -- ^ bit 0: @announce_channel@
  , OpenChannel -> Maybe ScriptPubKey
open_channel_upfront_shutdown_script       :: !(Maybe ScriptPubKey)
    -- ^ TLV type 0; an empty script commits to no particular script
  , OpenChannel -> Maybe FeatureVector
open_channel_channel_type                  :: !(Maybe BOLT9.FeatureVector)
    -- ^ TLV type 1
  , OpenChannel -> TlvStream
open_channel_tlvs                          :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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).
data AcceptChannel = AcceptChannel
  { AcceptChannel -> ChannelId
accept_channel_temporary_channel_id          :: !ChannelId
  , AcceptChannel -> Satoshi
accept_channel_dust_limit_satoshis           :: {-# UNPACK #-} !Satoshi
  , AcceptChannel -> Word64
accept_channel_max_htlc_value_in_flight_msat :: {-# UNPACK #-} !Word64
    -- ^ a cap, often @maxBound@, so not a bounded amount
  , AcceptChannel -> Satoshi
accept_channel_channel_reserve_satoshis      :: {-# UNPACK #-} !Satoshi
  , AcceptChannel -> MilliSatoshi
accept_channel_htlc_minimum_msat
      :: {-# UNPACK #-} !MilliSatoshi
  , AcceptChannel -> Word32
accept_channel_minimum_depth                :: {-# UNPACK #-} !Word32
  , AcceptChannel -> Word16
accept_channel_to_self_delay                 :: {-# UNPACK #-} !Word16
  , AcceptChannel -> Word16
accept_channel_max_accepted_htlcs            :: {-# UNPACK #-} !Word16
  , AcceptChannel -> Point
accept_channel_funding_pubkey                :: !Point
  , AcceptChannel -> Point
accept_channel_revocation_basepoint          :: !Point
  , AcceptChannel -> Point
accept_channel_payment_basepoint             :: !Point
  , AcceptChannel -> Point
accept_channel_delayed_payment_basepoint     :: !Point
  , AcceptChannel -> Point
accept_channel_htlc_basepoint                :: !Point
  , AcceptChannel -> Point
accept_channel_first_per_commitment_point    :: !Point
  , AcceptChannel -> Maybe ScriptPubKey
accept_channel_upfront_shutdown_script       :: !(Maybe ScriptPubKey)
    -- ^ TLV type 0; an empty script commits to no particular script
  , AcceptChannel -> Maybe FeatureVector
accept_channel_channel_type
      :: !(Maybe BOLT9.FeatureVector)
    -- ^ TLV type 1
  , AcceptChannel -> TlvStream
accept_channel_tlvs                          :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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).
data FundingCreated = FundingCreated
  { FundingCreated -> ChannelId
funding_created_temporary_channel_id :: !ChannelId
  , FundingCreated -> TxId
funding_created_funding_txid         :: !TxId
  , FundingCreated -> Word16
funding_created_funding_output_index :: {-# UNPACK #-} !Word16
  , FundingCreated -> Signature
funding_created_signature            :: !Signature
  , FundingCreated -> TlvStream
funding_created_tlvs                 :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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).
data FundingSigned = FundingSigned
  { FundingSigned -> ChannelId
funding_signed_channel_id :: !ChannelId
  , FundingSigned -> Signature
funding_signed_signature  :: !Signature
  , FundingSigned -> TlvStream
funding_signed_tlvs       :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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).
data ChannelReady = ChannelReady
  { ChannelReady -> ChannelId
channel_ready_channel_id                  :: !ChannelId
  , ChannelReady -> Point
channel_ready_second_per_commitment_point :: !Point
  , ChannelReady -> Maybe ShortChannelId
channel_ready_alias                       :: !(Maybe ShortChannelId)
    -- ^ the @short_channel_id@ record (TLV type 1)
  , ChannelReady -> TlvStream
channel_ready_tlvs                        :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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).
data OpenChannel2 = OpenChannel2
  { OpenChannel2 -> ChainHash
open_channel2_chain_hash                    :: !ChainHash
  , OpenChannel2 -> ChannelId
open_channel2_temporary_channel_id          :: !ChannelId
  , OpenChannel2 -> Word32
open_channel2_funding_feerate_perkw         :: {-# UNPACK #-} !Word32
  , OpenChannel2 -> Word32
open_channel2_commitment_feerate_perkw      :: {-# UNPACK #-} !Word32
  , OpenChannel2 -> Satoshi
open_channel2_funding_satoshis              :: {-# UNPACK #-} !Satoshi
  , OpenChannel2 -> Satoshi
open_channel2_dust_limit_satoshis           :: {-# UNPACK #-} !Satoshi
  , OpenChannel2 -> Word64
open_channel2_max_htlc_value_in_flight_msat :: {-# UNPACK #-} !Word64
    -- ^ a cap, often @maxBound@, so not a bounded amount
  , OpenChannel2 -> MilliSatoshi
open_channel2_htlc_minimum_msat
      :: {-# UNPACK #-} !MilliSatoshi
  , OpenChannel2 -> Word16
open_channel2_to_self_delay                 :: {-# UNPACK #-} !Word16
  , OpenChannel2 -> Word16
open_channel2_max_accepted_htlcs            :: {-# UNPACK #-} !Word16
  , OpenChannel2 -> Word32
open_channel2_locktime                      :: {-# UNPACK #-} !Word32
  , OpenChannel2 -> Point
open_channel2_funding_pubkey                :: !Point
  , OpenChannel2 -> Point
open_channel2_revocation_basepoint          :: !Point
  , OpenChannel2 -> Point
open_channel2_payment_basepoint             :: !Point
  , OpenChannel2 -> Point
open_channel2_delayed_payment_basepoint     :: !Point
  , OpenChannel2 -> Point
open_channel2_htlc_basepoint                :: !Point
  , OpenChannel2 -> Point
open_channel2_first_per_commitment_point    :: !Point
  , OpenChannel2 -> Point
open_channel2_second_per_commitment_point   :: !Point
  , OpenChannel2 -> Word8
open_channel2_channel_flags                 :: {-# UNPACK #-} !Word8
    -- ^ bit 0: @announce_channel@
  , OpenChannel2 -> Maybe ScriptPubKey
open_channel2_upfront_shutdown_script       :: !(Maybe ScriptPubKey)
    -- ^ TLV type 0; an empty script commits to no particular script
  , OpenChannel2 -> Maybe FeatureVector
open_channel2_channel_type
      :: !(Maybe BOLT9.FeatureVector)
    -- ^ TLV type 1
  , OpenChannel2 -> Bool
open_channel2_require_confirmed_inputs      :: !Bool
    -- ^ TLV type 2
  , OpenChannel2 -> TlvStream
open_channel2_tlvs                          :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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).
data AcceptChannel2 = AcceptChannel2
  { AcceptChannel2 -> ChannelId
accept_channel2_temporary_channel_id          :: !ChannelId
  , AcceptChannel2 -> Satoshi
accept_channel2_funding_satoshis              :: {-# UNPACK #-} !Satoshi
  , AcceptChannel2 -> Satoshi
accept_channel2_dust_limit_satoshis           :: {-# UNPACK #-} !Satoshi
  , AcceptChannel2 -> Word64
accept_channel2_max_htlc_value_in_flight_msat :: {-# UNPACK #-} !Word64
    -- ^ a cap, often @maxBound@, so not a bounded amount
  , AcceptChannel2 -> MilliSatoshi
accept_channel2_htlc_minimum_msat
      :: {-# UNPACK #-} !MilliSatoshi
  , AcceptChannel2 -> Word32
accept_channel2_minimum_depth                 :: {-# UNPACK #-} !Word32
  , AcceptChannel2 -> Word16
accept_channel2_to_self_delay                 :: {-# UNPACK #-} !Word16
  , AcceptChannel2 -> Word16
accept_channel2_max_accepted_htlcs            :: {-# UNPACK #-} !Word16
  , AcceptChannel2 -> Point
accept_channel2_funding_pubkey                :: !Point
  , AcceptChannel2 -> Point
accept_channel2_revocation_basepoint          :: !Point
  , AcceptChannel2 -> Point
accept_channel2_payment_basepoint             :: !Point
  , AcceptChannel2 -> Point
accept_channel2_delayed_payment_basepoint     :: !Point
  , AcceptChannel2 -> Point
accept_channel2_htlc_basepoint                :: !Point
  , AcceptChannel2 -> Point
accept_channel2_first_per_commitment_point    :: !Point
  , AcceptChannel2 -> Point
accept_channel2_second_per_commitment_point   :: !Point
  , AcceptChannel2 -> Maybe ScriptPubKey
accept_channel2_upfront_shutdown_script
      :: !(Maybe ScriptPubKey)
    -- ^ TLV type 0; an empty script commits to no particular script
  , AcceptChannel2 -> Maybe FeatureVector
accept_channel2_channel_type
      :: !(Maybe BOLT9.FeatureVector)
    -- ^ TLV type 1
  , AcceptChannel2 -> Bool
accept_channel2_require_confirmed_inputs      :: !Bool
    -- ^ TLV type 2
  , AcceptChannel2 -> TlvStream
accept_channel2_tlvs                          :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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

-- | The @tx_add_input@ message (type 66).
data TxAddInput = TxAddInput
  { TxAddInput -> ChannelId
tx_add_input_channel_id  :: !ChannelId
  , TxAddInput -> SerialId
tx_add_input_serial_id   :: !SerialId
  , TxAddInput -> ByteString
tx_add_input_prevtx      :: !BS.ByteString
    -- ^ the serialized previous transaction
  , TxAddInput -> Word32
tx_add_input_prevtx_vout :: {-# UNPACK #-} !Word32
  , TxAddInput -> Word32
tx_add_input_sequence    :: {-# UNPACK #-} !Word32
  , TxAddInput -> TlvStream
tx_add_input_tlvs        :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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).
data TxAddOutput = TxAddOutput
  { TxAddOutput -> ChannelId
tx_add_output_channel_id :: !ChannelId
  , TxAddOutput -> SerialId
tx_add_output_serial_id  :: !SerialId
  , TxAddOutput -> Satoshi
tx_add_output_sats       :: {-# UNPACK #-} !Satoshi
  , TxAddOutput -> ScriptPubKey
tx_add_output_script     :: !ScriptPubKey
  , TxAddOutput -> TlvStream
tx_add_output_tlvs       :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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).
data TxRemoveInput = TxRemoveInput
  { TxRemoveInput -> ChannelId
tx_remove_input_channel_id :: !ChannelId
  , TxRemoveInput -> SerialId
tx_remove_input_serial_id  :: !SerialId
  , TxRemoveInput -> TlvStream
tx_remove_input_tlvs       :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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).
data TxRemoveOutput = TxRemoveOutput
  { TxRemoveOutput -> ChannelId
tx_remove_output_channel_id :: !ChannelId
  , TxRemoveOutput -> SerialId
tx_remove_output_serial_id  :: !SerialId
  , TxRemoveOutput -> TlvStream
tx_remove_output_tlvs       :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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).
data TxComplete = TxComplete
  { TxComplete -> ChannelId
tx_complete_channel_id :: !ChannelId
  , TxComplete -> TlvStream
tx_complete_tlvs       :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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

-- | The @tx_signatures@ message (type 71).
data TxSignatures = TxSignatures
  { TxSignatures -> ChannelId
tx_signatures_channel_id :: !ChannelId
  , TxSignatures -> TxId
tx_signatures_txid       :: !TxId
  , TxSignatures -> [Witness]
tx_signatures_witnesses  :: ![Witness]
    -- ^ ordered by the @serial_id@ of the inputs they spend
  , TxSignatures -> TlvStream
tx_signatures_tlvs       :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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).
data TxInitRbf = TxInitRbf
  { TxInitRbf -> ChannelId
tx_init_rbf_channel_id                  :: !ChannelId
  , TxInitRbf -> Word32
tx_init_rbf_locktime                    :: {-# UNPACK #-} !Word32
  , TxInitRbf -> Word32
tx_init_rbf_feerate                     :: {-# UNPACK #-} !Word32
  , TxInitRbf -> Maybe Int64
tx_init_rbf_funding_output_contribution :: !(Maybe Int64)
    -- ^ TLV type 0, in satoshis
  , TxInitRbf -> Bool
tx_init_rbf_require_confirmed_inputs    :: !Bool
    -- ^ TLV type 2
  , TxInitRbf -> TlvStream
tx_init_rbf_tlvs                        :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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).
data TxAckRbf = TxAckRbf
  { TxAckRbf -> ChannelId
tx_ack_rbf_channel_id                  :: !ChannelId
  , TxAckRbf -> Maybe Int64
tx_ack_rbf_funding_output_contribution :: !(Maybe Int64)
    -- ^ TLV type 0, in satoshis
  , TxAckRbf -> Bool
tx_ack_rbf_require_confirmed_inputs    :: !Bool
    -- ^ TLV type 2
  , TxAckRbf -> TlvStream
tx_ack_rbf_tlvs                        :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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).
data TxAbort = TxAbort
  { TxAbort -> ChannelId
tx_abort_channel_id :: !ChannelId
  , TxAbort -> ByteString
tx_abort_data       :: !BS.ByteString
  , TxAbort -> TlvStream
tx_abort_tlvs       :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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 quiescence ---------------------------------------------------------

-- | The @stfu@ message (type 2).
data Stfu = Stfu
  { Stfu -> ChannelId
stfu_channel_id :: !ChannelId
  , Stfu -> Bool
stfu_initiator  :: !Bool
    -- ^ whether the sender initiated quiescence (sent as 1 or 0)
  , Stfu -> TlvStream
stfu_tlvs       :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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

-- channel close --------------------------------------------------------------

-- | The @shutdown@ message (type 38).
data Shutdown = Shutdown
  { Shutdown -> ChannelId
shutdown_channel_id   :: !ChannelId
  , Shutdown -> ScriptPubKey
shutdown_scriptpubkey :: !ScriptPubKey
  , Shutdown -> TlvStream
shutdown_tlvs         :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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_complete@ message (type 40).
data ClosingComplete = ClosingComplete
  { ClosingComplete -> ChannelId
closing_complete_channel_id                :: !ChannelId
  , ClosingComplete -> ScriptPubKey
closing_complete_closer_scriptpubkey       :: !ScriptPubKey
  , ClosingComplete -> ScriptPubKey
closing_complete_closee_scriptpubkey       :: !ScriptPubKey
  , ClosingComplete -> Satoshi
closing_complete_fee_satoshis              :: {-# UNPACK #-} !Satoshi
  , ClosingComplete -> Word32
closing_complete_locktime                  :: {-# UNPACK #-} !Word32
  , ClosingComplete -> Maybe Signature
closing_complete_closer_output_only        :: !(Maybe Signature)
    -- ^ TLV type 1
  , ClosingComplete -> Maybe Signature
closing_complete_closee_output_only        :: !(Maybe Signature)
    -- ^ TLV type 2
  , ClosingComplete -> Maybe Signature
closing_complete_closer_and_closee_outputs :: !(Maybe Signature)
    -- ^ TLV type 3
  , ClosingComplete -> TlvStream
closing_complete_tlvs                      :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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). A valid @closing_sig@ carries
--   exactly one signature, in a field set in the @closing_complete@ it
--   answers; checking that is left to the caller.
data ClosingSig = ClosingSig
  { ClosingSig -> ChannelId
closing_sig_channel_id                :: !ChannelId
  , ClosingSig -> ScriptPubKey
closing_sig_closer_scriptpubkey       :: !ScriptPubKey
  , ClosingSig -> ScriptPubKey
closing_sig_closee_scriptpubkey       :: !ScriptPubKey
  , ClosingSig -> Satoshi
closing_sig_fee_satoshis              :: {-# UNPACK #-} !Satoshi
  , ClosingSig -> Word32
closing_sig_locktime                  :: {-# UNPACK #-} !Word32
  , ClosingSig -> Maybe Signature
closing_sig_closer_output_only        :: !(Maybe Signature)
    -- ^ TLV type 1
  , ClosingSig -> Maybe Signature
closing_sig_closee_output_only        :: !(Maybe Signature)
    -- ^ TLV type 2
  , ClosingSig -> Maybe Signature
closing_sig_closer_and_closee_outputs :: !(Maybe Signature)
    -- ^ TLV type 3
  , ClosingSig -> TlvStream
closing_sig_tlvs                      :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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

-- | The legacy @closing_signed@ message (type 39), used when
--   @option_simple_close@ is not negotiated.
data ClosingSigned = ClosingSigned
  { ClosingSigned -> ChannelId
closing_signed_channel_id   :: !ChannelId
  , ClosingSigned -> Satoshi
closing_signed_fee_satoshis :: {-# UNPACK #-} !Satoshi
  , ClosingSigned -> Signature
closing_signed_signature    :: !Signature
  , ClosingSigned -> Maybe FeeRange
closing_signed_fee_range    :: !(Maybe FeeRange)
    -- ^ TLV type 1
  , ClosingSigned -> TlvStream
closing_signed_tlvs         :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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

-- normal operation -----------------------------------------------------------

-- | The @update_add_htlc@ message (type 128).
data UpdateAddHtlc = UpdateAddHtlc
  { UpdateAddHtlc -> ChannelId
update_add_htlc_channel_id           :: !ChannelId
  , UpdateAddHtlc -> HtlcId
update_add_htlc_id                   :: !HtlcId
  , UpdateAddHtlc -> MilliSatoshi
update_add_htlc_amount_msat          :: {-# UNPACK #-} !MilliSatoshi
  , UpdateAddHtlc -> PaymentHash
update_add_htlc_payment_hash         :: !PaymentHash
  , UpdateAddHtlc -> Word32
update_add_htlc_cltv_expiry          :: {-# UNPACK #-} !Word32
  , UpdateAddHtlc -> OnionRoutingPacket
update_add_htlc_onion_routing_packet :: !OnionRoutingPacket
  , UpdateAddHtlc -> Maybe Point
update_add_htlc_path_key             :: !(Maybe Point)
    -- ^ the @blinded_path@ record (TLV type 0)
  , UpdateAddHtlc -> TlvStream
update_add_htlc_tlvs                 :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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).
data UpdateFulfillHtlc = UpdateFulfillHtlc
  { UpdateFulfillHtlc -> ChannelId
update_fulfill_htlc_channel_id          :: !ChannelId
  , UpdateFulfillHtlc -> HtlcId
update_fulfill_htlc_id                  :: !HtlcId
  , UpdateFulfillHtlc -> PaymentPreimage
update_fulfill_htlc_payment_preimage    :: !PaymentPreimage
  , UpdateFulfillHtlc -> Maybe AttributionData
update_fulfill_htlc_attribution_data    :: !(Maybe AttributionData)
    -- ^ TLV type 1
  , UpdateFulfillHtlc -> Maybe ByteString
update_fulfill_htlc_fulfillment_payload :: !(Maybe BS.ByteString)
    -- ^ TLV type 3
  , UpdateFulfillHtlc -> TlvStream
update_fulfill_htlc_tlvs                :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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).
data UpdateFailHtlc = UpdateFailHtlc
  { UpdateFailHtlc -> ChannelId
update_fail_htlc_channel_id       :: !ChannelId
  , UpdateFailHtlc -> HtlcId
update_fail_htlc_id               :: !HtlcId
  , UpdateFailHtlc -> ByteString
update_fail_htlc_reason           :: !BS.ByteString
  , UpdateFailHtlc -> Maybe AttributionData
update_fail_htlc_attribution_data :: !(Maybe AttributionData)
    -- ^ TLV type 1
  , UpdateFailHtlc -> TlvStream
update_fail_htlc_tlvs             :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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).
data UpdateFailMalformedHtlc = UpdateFailMalformedHtlc
  { UpdateFailMalformedHtlc -> ChannelId
update_fail_malformed_htlc_channel_id      :: !ChannelId
  , UpdateFailMalformedHtlc -> HtlcId
update_fail_malformed_htlc_id              :: !HtlcId
  , UpdateFailMalformedHtlc -> OnionHash
update_fail_malformed_htlc_sha256_of_onion :: !OnionHash
  , UpdateFailMalformedHtlc -> Word16
update_fail_malformed_htlc_failure_code    :: {-# UNPACK #-} !Word16
  , UpdateFailMalformedHtlc -> TlvStream
update_fail_malformed_htlc_tlvs            :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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).
data CommitmentSigned = CommitmentSigned
  { CommitmentSigned -> ChannelId
commitment_signed_channel_id      :: !ChannelId
  , CommitmentSigned -> Signature
commitment_signed_signature       :: !Signature
  , CommitmentSigned -> [Signature]
commitment_signed_htlc_signatures :: ![Signature]
  , CommitmentSigned -> Maybe TxId
commitment_signed_funding_txid    :: !(Maybe TxId)
    -- ^ TLV type 1
  , CommitmentSigned -> TlvStream
commitment_signed_tlvs            :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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).
data RevokeAndAck = RevokeAndAck
  { RevokeAndAck -> ChannelId
revoke_and_ack_channel_id                :: !ChannelId
  , RevokeAndAck -> PerCommitmentSecret
revoke_and_ack_per_commitment_secret     :: !PerCommitmentSecret
  , RevokeAndAck -> Point
revoke_and_ack_next_per_commitment_point :: !Point
  , RevokeAndAck -> TlvStream
revoke_and_ack_tlvs                      :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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).
data UpdateFee = UpdateFee
  { UpdateFee -> ChannelId
update_fee_channel_id     :: !ChannelId
  , UpdateFee -> Word32
update_fee_feerate_per_kw :: {-# UNPACK #-} !Word32
  , UpdateFee -> TlvStream
update_fee_tlvs           :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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

-- message retransmission -----------------------------------------------------

-- | The @channel_reestablish@ message (type 136).
data ChannelReestablish = ChannelReestablish
  { ChannelReestablish -> ChannelId
channel_reestablish_channel_id                      :: !ChannelId
  , ChannelReestablish -> Word64
channel_reestablish_next_commitment_number
      :: {-# UNPACK #-} !Word64
  , ChannelReestablish -> Word64
channel_reestablish_next_revocation_number
      :: {-# UNPACK #-} !Word64
  , ChannelReestablish -> PerCommitmentSecret
channel_reestablish_your_last_per_commitment_secret
      :: !PerCommitmentSecret
  , ChannelReestablish -> Point
channel_reestablish_my_current_per_commitment_point :: !Point
  , ChannelReestablish -> Maybe NextFunding
channel_reestablish_next_funding
      :: !(Maybe NextFunding)
    -- ^ TLV type 1
  , ChannelReestablish -> TlvStream
channel_reestablish_tlvs                            :: !TlvStream
    -- ^ unknown TLV records
  } deriving (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

-- messages -------------------------------------------------------------------

-- | A BOLT #2 message.
data Message
  = MsgOpenChannel !OpenChannel
  | MsgAcceptChannel !AcceptChannel
  | MsgFundingCreated !FundingCreated
  | MsgFundingSigned !FundingSigned
  | MsgChannelReady !ChannelReady
  | MsgOpenChannel2 !OpenChannel2
  | MsgAcceptChannel2 !AcceptChannel2
  | MsgTxAddInput !TxAddInput
  | MsgTxAddOutput !TxAddOutput
  | MsgTxRemoveInput !TxRemoveInput
  | MsgTxRemoveOutput !TxRemoveOutput
  | MsgTxComplete !TxComplete
  | MsgTxSignatures !TxSignatures
  | MsgTxInitRbf !TxInitRbf
  | MsgTxAckRbf !TxAckRbf
  | MsgTxAbort !TxAbort
  | MsgStfu !Stfu
  | MsgShutdown !Shutdown
  | MsgClosingComplete !ClosingComplete
  | MsgClosingSig !ClosingSig
  | MsgClosingSigned !ClosingSigned
  | MsgUpdateAddHtlc !UpdateAddHtlc
  | MsgUpdateFulfillHtlc !UpdateFulfillHtlc
  | MsgUpdateFailHtlc !UpdateFailHtlc
  | MsgUpdateFailMalformedHtlc !UpdateFailMalformedHtlc
  | MsgCommitmentSigned !CommitmentSigned
  | MsgRevokeAndAck !RevokeAndAck
  | MsgUpdateFee !UpdateFee
  | MsgChannelReestablish !ChannelReestablish
  deriving (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

-- | The wire type of a 'Message'.
--
--   >>> message_type (MsgTxComplete (TxComplete cid BOLT1.empty_tlv_stream))
--   70
message_type :: Message -> Word16
message_type :: Message -> Word16
message_type Message
m = case Message
m of
  MsgOpenChannel {}             -> Word16
32
  MsgAcceptChannel {}           -> Word16
33
  MsgFundingCreated {}          -> Word16
34
  MsgFundingSigned {}           -> Word16
35
  MsgChannelReady {}            -> Word16
36
  MsgOpenChannel2 {}            -> Word16
64
  MsgAcceptChannel2 {}          -> Word16
65
  MsgTxAddInput {}              -> Word16
66
  MsgTxAddOutput {}             -> Word16
67
  MsgTxRemoveInput {}           -> Word16
68
  MsgTxRemoveOutput {}          -> Word16
69
  MsgTxComplete {}              -> Word16
70
  MsgTxSignatures {}            -> Word16
71
  MsgTxInitRbf {}               -> Word16
72
  MsgTxAckRbf {}                -> Word16
73
  MsgTxAbort {}                 -> Word16
74
  MsgStfu {}                    -> Word16
2
  MsgShutdown {}                -> Word16
38
  MsgClosingComplete {}         -> Word16
40
  MsgClosingSig {}              -> Word16
41
  MsgClosingSigned {}           -> Word16
39
  MsgUpdateAddHtlc {}           -> Word16
128
  MsgUpdateFulfillHtlc {}       -> Word16
130
  MsgUpdateFailHtlc {}          -> Word16
131
  MsgUpdateFailMalformedHtlc {} -> Word16
135
  MsgCommitmentSigned {}        -> Word16
132
  MsgRevokeAndAck {}            -> Word16
133
  MsgUpdateFee {}               -> Word16
134
  MsgChannelReestablish {}      -> Word16
136