| Copyright | (c) 2025 Jared Tobin |
|---|---|
| License | MIT |
| Maintainer | Jared Tobin <jared@ppad.tech> |
| Safe Haskell | None |
| Language | Haskell2010 |
Lightning.Protocol.BOLT7
Description
Routing gossip for the Lightning Network, per BOLT #7: the gossip messages and queries, their signature digests and checksums, signature verification, and stateless validation.
Fundamental types (chain hashes, points, signatures, short channel ids, amounts, TLV streams) come from ppad-bolt1, and feature vectors from ppad-bolt9.
Decoders take a message payload, without its 2-byte type, and consume all of it. Every byte is kept, including unassigned flag bits, unknown address descriptors and unknown odd TLV records, so encoding a decoded message reproduces its payload exactly and its signatures still verify.
Synopsis
- data Message
- = MsgChannelAnnouncement !ChannelAnnouncement
- | MsgNodeAnnouncement !NodeAnnouncement
- | MsgChannelUpdate !ChannelUpdate
- | MsgAnnouncementSignatures !AnnouncementSignatures
- | MsgQueryShortChannelIds !QueryShortChannelIds
- | MsgReplyShortChannelIdsEnd !ReplyShortChannelIdsEnd
- | MsgQueryChannelRange !QueryChannelRange
- | MsgReplyChannelRange !ReplyChannelRange
- | MsgGossipTimestampFilter !GossipTimestampFilter
- message_type :: Message -> Word16
- data ChannelAnnouncement = ChannelAnnouncement {
- ca_node_signature_1 :: !Signature
- ca_node_signature_2 :: !Signature
- ca_bitcoin_signature_1 :: !Signature
- ca_bitcoin_signature_2 :: !Signature
- ca_features :: !FeatureVector
- ca_chain_hash :: !ChainHash
- ca_short_channel_id :: !ShortChannelId
- ca_node_id_1 :: !Point
- ca_node_id_2 :: !Point
- ca_bitcoin_key_1 :: !Point
- ca_bitcoin_key_2 :: !Point
- ca_tlvs :: !TlvStream
- data NodeAnnouncement = NodeAnnouncement {
- na_signature :: !Signature
- na_features :: !FeatureVector
- na_timestamp :: !Word32
- na_node_id :: !Point
- na_rgb_color :: !RgbColor
- na_alias :: !Alias
- na_addresses :: ![Address]
- na_unknown_addresses :: !ByteString
- na_tlvs :: !TlvStream
- data ChannelUpdate = ChannelUpdate {
- cu_signature :: !Signature
- cu_chain_hash :: !ChainHash
- cu_short_channel_id :: !ShortChannelId
- cu_timestamp :: !Word32
- cu_message_flags :: !MessageFlags
- cu_channel_flags :: !ChannelFlags
- cu_cltv_expiry_delta :: !Word16
- cu_htlc_minimum_msat :: !MilliSatoshi
- cu_fee_base_msat :: !Word32
- cu_fee_proportional_millionths :: !Word32
- cu_htlc_maximum_msat :: !MilliSatoshi
- cu_tlvs :: !TlvStream
- data AnnouncementSignatures = AnnouncementSignatures {}
- data QueryShortChannelIds = QueryShortChannelIds {}
- data ReplyShortChannelIdsEnd = ReplyShortChannelIdsEnd {}
- data QueryChannelRange = QueryChannelRange {}
- data ReplyChannelRange = ReplyChannelRange {}
- data GossipTimestampFilter = GossipTimestampFilter {}
- encode_message :: Message -> Either EncodeError ByteString
- decode_message :: Word16 -> ByteString -> Either DecodeError Message
- data EncodeError
- data DecodeError
- encode_channel_announcement :: ChannelAnnouncement -> Either EncodeError ByteString
- decode_channel_announcement :: ByteString -> Either DecodeError ChannelAnnouncement
- encode_node_announcement :: NodeAnnouncement -> Either EncodeError ByteString
- decode_node_announcement :: ByteString -> Either DecodeError NodeAnnouncement
- encode_channel_update :: ChannelUpdate -> ByteString
- decode_channel_update :: ByteString -> Either DecodeError ChannelUpdate
- encode_announcement_signatures :: AnnouncementSignatures -> ByteString
- decode_announcement_signatures :: ByteString -> Either DecodeError AnnouncementSignatures
- encode_query_short_channel_ids :: QueryShortChannelIds -> Either EncodeError ByteString
- decode_query_short_channel_ids :: ByteString -> Either DecodeError QueryShortChannelIds
- encode_reply_short_channel_ids_end :: ReplyShortChannelIdsEnd -> ByteString
- decode_reply_short_channel_ids_end :: ByteString -> Either DecodeError ReplyShortChannelIdsEnd
- encode_query_channel_range :: QueryChannelRange -> Either EncodeError ByteString
- decode_query_channel_range :: ByteString -> Either DecodeError QueryChannelRange
- encode_reply_channel_range :: ReplyChannelRange -> Either EncodeError ByteString
- decode_reply_channel_range :: ByteString -> Either DecodeError ReplyChannelRange
- encode_gossip_timestamp_filter :: GossipTimestampFilter -> ByteString
- decode_gossip_timestamp_filter :: ByteString -> Either DecodeError GossipTimestampFilter
- channel_announcement_hash :: ChannelAnnouncement -> Either EncodeError ByteString
- node_announcement_hash :: NodeAnnouncement -> Either EncodeError ByteString
- channel_update_hash :: ChannelUpdate -> ByteString
- verify_channel_announcement :: ChannelAnnouncement -> Bool
- verify_node_announcement :: NodeAnnouncement -> Bool
- verify_channel_update :: Point -> ChannelUpdate -> Bool
- channel_update_checksum :: ChannelUpdate -> Word32
- data ValidationError
- validate_channel_announcement :: ChannelAnnouncement -> Either ValidationError ()
- validate_node_announcement :: NodeAnnouncement -> Either ValidationError ()
- validate_channel_update :: ChannelUpdate -> Either ValidationError ()
- validate_query_short_channel_ids :: QueryShortChannelIds -> Either ValidationError ()
- validate_query_channel_range :: QueryChannelRange -> Either ValidationError ()
- validate_reply_channel_range :: ReplyChannelRange -> Either ValidationError ()
- newtype MessageFlags = MessageFlags Word8
- data Forwarding
- message_flags :: Forwarding -> MessageFlags
- message_flags_forwarding :: MessageFlags -> Forwarding
- has_must_be_one :: MessageFlags -> Bool
- newtype ChannelFlags = ChannelFlags Word8
- data Direction
- data ChannelStatus
- channel_flags :: Direction -> ChannelStatus -> ChannelFlags
- channel_flags_direction :: ChannelFlags -> Direction
- channel_flags_status :: ChannelFlags -> ChannelStatus
- data RgbColor = RgbColor !Word8 !Word8 !Word8
- data Alias
- alias :: ByteString -> Maybe Alias
- un_alias :: Alias -> ByteString
- data Address
- usable_addresses :: [Address] -> [Address]
- data IPv4Addr
- ipv4_addr :: ByteString -> Maybe IPv4Addr
- un_ipv4_addr :: IPv4Addr -> ByteString
- data IPv6Addr
- ipv6_addr :: ByteString -> Maybe IPv6Addr
- un_ipv6_addr :: IPv6Addr -> ByteString
- data TorV2Addr
- tor_v2_addr :: ByteString -> Maybe TorV2Addr
- un_tor_v2_addr :: TorV2Addr -> ByteString
- data TorV3Addr
- tor_v3_addr :: ByteString -> Maybe TorV3Addr
- un_tor_v3_addr :: TorV3Addr -> ByteString
- data Hostname
- hostname :: ByteString -> Maybe Hostname
- un_hostname :: Hostname -> ByteString
- is_ascii_hostname :: Hostname -> Bool
- newtype QueryFlags = QueryFlags Word64
- data QueryFlag
- query_flags :: [QueryFlag] -> QueryFlags
- has_query_flag :: QueryFlag -> QueryFlags -> Bool
- newtype QueryOption = QueryOption Word64
- data QueryOptionFlag
- query_option :: [QueryOptionFlag] -> QueryOption
- has_query_option :: QueryOptionFlag -> QueryOption -> Bool
- data ChannelUpdateTimestamps = ChannelUpdateTimestamps !Word32 !Word32
- data ChannelUpdateChecksums = ChannelUpdateChecksums !Word32 !Word32
- format_short_channel_id :: ShortChannelId -> String
Messages
A BOLT #7 message.
Constructors
Instances
data ChannelAnnouncement Source #
The channel_announcement message (type 256).
Constructors
| ChannelAnnouncement | |
Fields
| |
Instances
| NFData ChannelAnnouncement Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods rnf :: ChannelAnnouncement -> () # | |||||
| Generic ChannelAnnouncement Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Associated Types
Methods from :: ChannelAnnouncement -> Rep ChannelAnnouncement x # to :: Rep ChannelAnnouncement x -> ChannelAnnouncement # | |||||
| Show ChannelAnnouncement Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods showsPrec :: Int -> ChannelAnnouncement -> ShowS # show :: ChannelAnnouncement -> String # showList :: [ChannelAnnouncement] -> ShowS # | |||||
| Eq ChannelAnnouncement Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods (==) :: ChannelAnnouncement -> ChannelAnnouncement -> Bool # (/=) :: ChannelAnnouncement -> ChannelAnnouncement -> Bool # | |||||
| type Rep ChannelAnnouncement Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages type Rep ChannelAnnouncement = D1 ('MetaData "ChannelAnnouncement" "Lightning.Protocol.BOLT7.Messages" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'False) (C1 ('MetaCons "ChannelAnnouncement" 'PrefixI 'True) (((S1 ('MetaSel ('Just "ca_node_signature_1") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Signature) :*: (S1 ('MetaSel ('Just "ca_node_signature_2") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Signature) :*: S1 ('MetaSel ('Just "ca_bitcoin_signature_1") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Signature))) :*: (S1 ('MetaSel ('Just "ca_bitcoin_signature_2") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Signature) :*: (S1 ('MetaSel ('Just "ca_features") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 FeatureVector) :*: S1 ('MetaSel ('Just "ca_chain_hash") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ChainHash)))) :*: ((S1 ('MetaSel ('Just "ca_short_channel_id") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 ShortChannelId) :*: (S1 ('MetaSel ('Just "ca_node_id_1") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Point) :*: S1 ('MetaSel ('Just "ca_node_id_2") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Point))) :*: (S1 ('MetaSel ('Just "ca_bitcoin_key_1") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Point) :*: (S1 ('MetaSel ('Just "ca_bitcoin_key_2") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Point) :*: S1 ('MetaSel ('Just "ca_tlvs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TlvStream)))))) | |||||
data NodeAnnouncement Source #
The node_announcement message (type 257).
Constructors
| NodeAnnouncement | |
Fields
| |
Instances
| NFData NodeAnnouncement Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods rnf :: NodeAnnouncement -> () # | |||||
| Generic NodeAnnouncement Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Associated Types
Methods from :: NodeAnnouncement -> Rep NodeAnnouncement x # to :: Rep NodeAnnouncement x -> NodeAnnouncement # | |||||
| Show NodeAnnouncement Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods showsPrec :: Int -> NodeAnnouncement -> ShowS # show :: NodeAnnouncement -> String # showList :: [NodeAnnouncement] -> ShowS # | |||||
| Eq NodeAnnouncement Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods (==) :: NodeAnnouncement -> NodeAnnouncement -> Bool # (/=) :: NodeAnnouncement -> NodeAnnouncement -> Bool # | |||||
| type Rep NodeAnnouncement Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages type Rep NodeAnnouncement = D1 ('MetaData "NodeAnnouncement" "Lightning.Protocol.BOLT7.Messages" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'False) (C1 ('MetaCons "NodeAnnouncement" 'PrefixI 'True) (((S1 ('MetaSel ('Just "na_signature") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Signature) :*: S1 ('MetaSel ('Just "na_features") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 FeatureVector)) :*: (S1 ('MetaSel ('Just "na_timestamp") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: S1 ('MetaSel ('Just "na_node_id") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Point))) :*: ((S1 ('MetaSel ('Just "na_rgb_color") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 RgbColor) :*: S1 ('MetaSel ('Just "na_alias") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Alias)) :*: (S1 ('MetaSel ('Just "na_addresses") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [Address]) :*: (S1 ('MetaSel ('Just "na_unknown_addresses") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString) :*: S1 ('MetaSel ('Just "na_tlvs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TlvStream)))))) | |||||
data ChannelUpdate Source #
The channel_update message (type 258).
Constructors
| ChannelUpdate | |
Fields
| |
Instances
| NFData ChannelUpdate Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods rnf :: ChannelUpdate -> () # | |||||
| Generic ChannelUpdate Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Associated Types
| |||||
| Show ChannelUpdate Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods showsPrec :: Int -> ChannelUpdate -> ShowS # show :: ChannelUpdate -> String # showList :: [ChannelUpdate] -> ShowS # | |||||
| Eq ChannelUpdate Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods (==) :: ChannelUpdate -> ChannelUpdate -> Bool # (/=) :: ChannelUpdate -> ChannelUpdate -> Bool # | |||||
| type Rep ChannelUpdate Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages type Rep ChannelUpdate = D1 ('MetaData "ChannelUpdate" "Lightning.Protocol.BOLT7.Messages" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'False) (C1 ('MetaCons "ChannelUpdate" 'PrefixI 'True) (((S1 ('MetaSel ('Just "cu_signature") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Signature) :*: (S1 ('MetaSel ('Just "cu_chain_hash") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ChainHash) :*: S1 ('MetaSel ('Just "cu_short_channel_id") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 ShortChannelId))) :*: (S1 ('MetaSel ('Just "cu_timestamp") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: (S1 ('MetaSel ('Just "cu_message_flags") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 MessageFlags) :*: S1 ('MetaSel ('Just "cu_channel_flags") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 ChannelFlags)))) :*: ((S1 ('MetaSel ('Just "cu_cltv_expiry_delta") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word16) :*: (S1 ('MetaSel ('Just "cu_htlc_minimum_msat") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 MilliSatoshi) :*: S1 ('MetaSel ('Just "cu_fee_base_msat") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32))) :*: (S1 ('MetaSel ('Just "cu_fee_proportional_millionths") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: (S1 ('MetaSel ('Just "cu_htlc_maximum_msat") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 MilliSatoshi) :*: S1 ('MetaSel ('Just "cu_tlvs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TlvStream)))))) | |||||
data AnnouncementSignatures Source #
The announcement_signatures message (type 259).
Constructors
| AnnouncementSignatures | |
Fields
| |
Instances
| NFData AnnouncementSignatures Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods rnf :: AnnouncementSignatures -> () # | |||||
| Generic AnnouncementSignatures Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Associated Types
Methods from :: AnnouncementSignatures -> Rep AnnouncementSignatures x # to :: Rep AnnouncementSignatures x -> AnnouncementSignatures # | |||||
| Show AnnouncementSignatures Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods showsPrec :: Int -> AnnouncementSignatures -> ShowS # show :: AnnouncementSignatures -> String # showList :: [AnnouncementSignatures] -> ShowS # | |||||
| Eq AnnouncementSignatures Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods (==) :: AnnouncementSignatures -> AnnouncementSignatures -> Bool # (/=) :: AnnouncementSignatures -> AnnouncementSignatures -> Bool # | |||||
| type Rep AnnouncementSignatures Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages type Rep AnnouncementSignatures = D1 ('MetaData "AnnouncementSignatures" "Lightning.Protocol.BOLT7.Messages" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'False) (C1 ('MetaCons "AnnouncementSignatures" 'PrefixI 'True) ((S1 ('MetaSel ('Just "as_channel_id") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ChannelId) :*: S1 ('MetaSel ('Just "as_short_channel_id") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 ShortChannelId)) :*: (S1 ('MetaSel ('Just "as_node_signature") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Signature) :*: (S1 ('MetaSel ('Just "as_bitcoin_signature") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Signature) :*: S1 ('MetaSel ('Just "as_tlvs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TlvStream))))) | |||||
data QueryShortChannelIds Source #
The query_short_channel_ids message (type 261).
Constructors
| QueryShortChannelIds | |
Fields
| |
Instances
| NFData QueryShortChannelIds Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods rnf :: QueryShortChannelIds -> () # | |||||
| Generic QueryShortChannelIds Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Associated Types
Methods from :: QueryShortChannelIds -> Rep QueryShortChannelIds x # to :: Rep QueryShortChannelIds x -> QueryShortChannelIds # | |||||
| Show QueryShortChannelIds Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods showsPrec :: Int -> QueryShortChannelIds -> ShowS # show :: QueryShortChannelIds -> String # showList :: [QueryShortChannelIds] -> ShowS # | |||||
| Eq QueryShortChannelIds Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods (==) :: QueryShortChannelIds -> QueryShortChannelIds -> Bool # (/=) :: QueryShortChannelIds -> QueryShortChannelIds -> Bool # | |||||
| type Rep QueryShortChannelIds Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages type Rep QueryShortChannelIds = D1 ('MetaData "QueryShortChannelIds" "Lightning.Protocol.BOLT7.Messages" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'False) (C1 ('MetaCons "QueryShortChannelIds" 'PrefixI 'True) ((S1 ('MetaSel ('Just "qsci_chain_hash") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ChainHash) :*: S1 ('MetaSel ('Just "qsci_short_channel_ids") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [ShortChannelId])) :*: (S1 ('MetaSel ('Just "qsci_query_flags") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe [QueryFlags])) :*: S1 ('MetaSel ('Just "qsci_tlvs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TlvStream)))) | |||||
data ReplyShortChannelIdsEnd Source #
The reply_short_channel_ids_end message (type 262).
Constructors
| ReplyShortChannelIdsEnd | |
Fields
| |
Instances
| NFData ReplyShortChannelIdsEnd Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods rnf :: ReplyShortChannelIdsEnd -> () # | |||||
| Generic ReplyShortChannelIdsEnd Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Associated Types
Methods from :: ReplyShortChannelIdsEnd -> Rep ReplyShortChannelIdsEnd x # to :: Rep ReplyShortChannelIdsEnd x -> ReplyShortChannelIdsEnd # | |||||
| Show ReplyShortChannelIdsEnd Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods showsPrec :: Int -> ReplyShortChannelIdsEnd -> ShowS # show :: ReplyShortChannelIdsEnd -> String # showList :: [ReplyShortChannelIdsEnd] -> ShowS # | |||||
| Eq ReplyShortChannelIdsEnd Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods (==) :: ReplyShortChannelIdsEnd -> ReplyShortChannelIdsEnd -> Bool # (/=) :: ReplyShortChannelIdsEnd -> ReplyShortChannelIdsEnd -> Bool # | |||||
| type Rep ReplyShortChannelIdsEnd Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages type Rep ReplyShortChannelIdsEnd = D1 ('MetaData "ReplyShortChannelIdsEnd" "Lightning.Protocol.BOLT7.Messages" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'False) (C1 ('MetaCons "ReplyShortChannelIdsEnd" 'PrefixI 'True) (S1 ('MetaSel ('Just "rsce_chain_hash") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ChainHash) :*: (S1 ('MetaSel ('Just "rsce_full_information") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "rsce_tlvs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TlvStream)))) | |||||
data QueryChannelRange Source #
The query_channel_range message (type 263).
Constructors
| QueryChannelRange | |
Fields
| |
Instances
| NFData QueryChannelRange Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods rnf :: QueryChannelRange -> () # | |||||
| Generic QueryChannelRange Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Associated Types
Methods from :: QueryChannelRange -> Rep QueryChannelRange x # to :: Rep QueryChannelRange x -> QueryChannelRange # | |||||
| Show QueryChannelRange Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods showsPrec :: Int -> QueryChannelRange -> ShowS # show :: QueryChannelRange -> String # showList :: [QueryChannelRange] -> ShowS # | |||||
| Eq QueryChannelRange Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods (==) :: QueryChannelRange -> QueryChannelRange -> Bool # (/=) :: QueryChannelRange -> QueryChannelRange -> Bool # | |||||
| type Rep QueryChannelRange Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages type Rep QueryChannelRange = D1 ('MetaData "QueryChannelRange" "Lightning.Protocol.BOLT7.Messages" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'False) (C1 ('MetaCons "QueryChannelRange" 'PrefixI 'True) ((S1 ('MetaSel ('Just "qcr_chain_hash") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ChainHash) :*: S1 ('MetaSel ('Just "qcr_first_blocknum") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32)) :*: (S1 ('MetaSel ('Just "qcr_number_of_blocks") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: (S1 ('MetaSel ('Just "qcr_query_option") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe QueryOption)) :*: S1 ('MetaSel ('Just "qcr_tlvs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TlvStream))))) | |||||
data ReplyChannelRange Source #
The reply_channel_range message (type 264).
Constructors
| ReplyChannelRange | |
Fields
| |
Instances
| NFData ReplyChannelRange Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods rnf :: ReplyChannelRange -> () # | |||||
| Generic ReplyChannelRange Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Associated Types
Methods from :: ReplyChannelRange -> Rep ReplyChannelRange x # to :: Rep ReplyChannelRange x -> ReplyChannelRange # | |||||
| Show ReplyChannelRange Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods showsPrec :: Int -> ReplyChannelRange -> ShowS # show :: ReplyChannelRange -> String # showList :: [ReplyChannelRange] -> ShowS # | |||||
| Eq ReplyChannelRange Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods (==) :: ReplyChannelRange -> ReplyChannelRange -> Bool # (/=) :: ReplyChannelRange -> ReplyChannelRange -> Bool # | |||||
| type Rep ReplyChannelRange Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages type Rep ReplyChannelRange = D1 ('MetaData "ReplyChannelRange" "Lightning.Protocol.BOLT7.Messages" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'False) (C1 ('MetaCons "ReplyChannelRange" 'PrefixI 'True) (((S1 ('MetaSel ('Just "rcr_chain_hash") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ChainHash) :*: S1 ('MetaSel ('Just "rcr_first_blocknum") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32)) :*: (S1 ('MetaSel ('Just "rcr_number_of_blocks") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: S1 ('MetaSel ('Just "rcr_sync_complete") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool))) :*: ((S1 ('MetaSel ('Just "rcr_short_channel_ids") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [ShortChannelId]) :*: S1 ('MetaSel ('Just "rcr_timestamps") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe [ChannelUpdateTimestamps]))) :*: (S1 ('MetaSel ('Just "rcr_checksums") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe [ChannelUpdateChecksums])) :*: S1 ('MetaSel ('Just "rcr_tlvs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TlvStream))))) | |||||
data GossipTimestampFilter Source #
The gossip_timestamp_filter message (type 265).
Constructors
| GossipTimestampFilter | |
Fields
| |
Instances
| NFData GossipTimestampFilter Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods rnf :: GossipTimestampFilter -> () # | |||||
| Generic GossipTimestampFilter Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Associated Types
Methods from :: GossipTimestampFilter -> Rep GossipTimestampFilter x # to :: Rep GossipTimestampFilter x -> GossipTimestampFilter # | |||||
| Show GossipTimestampFilter Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods showsPrec :: Int -> GossipTimestampFilter -> ShowS # show :: GossipTimestampFilter -> String # showList :: [GossipTimestampFilter] -> ShowS # | |||||
| Eq GossipTimestampFilter Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages Methods (==) :: GossipTimestampFilter -> GossipTimestampFilter -> Bool # (/=) :: GossipTimestampFilter -> GossipTimestampFilter -> Bool # | |||||
| type Rep GossipTimestampFilter Source # | |||||
Defined in Lightning.Protocol.BOLT7.Messages type Rep GossipTimestampFilter = D1 ('MetaData "GossipTimestampFilter" "Lightning.Protocol.BOLT7.Messages" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'False) (C1 ('MetaCons "GossipTimestampFilter" 'PrefixI 'True) ((S1 ('MetaSel ('Just "gtf_chain_hash") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ChainHash) :*: S1 ('MetaSel ('Just "gtf_first_timestamp") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32)) :*: (S1 ('MetaSel ('Just "gtf_timestamp_range") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: S1 ('MetaSel ('Just "gtf_tlvs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TlvStream)))) | |||||
Encoding and decoding
encode_message :: Message -> Either EncodeError ByteString Source #
Encode a Message payload (excluding the 2-byte message type; see
message_type). Frame the result with
encode_envelope, which enforces the
65535-byte message limit.
decode_message :: Word16 -> ByteString -> Either DecodeError Message Source #
Decode a message payload, given its message type (as split off by
decode_envelope).
>>>decode_message 260 "\NUL"Left (DecodeUnknownType 260)
data EncodeError Source #
Why a message failed to encode.
Constructors
| EncodeLengthOverflow | a length-prefixed field exceeds 65535 bytes |
| EncodeInvalidTlvs | a |
| EncodeCountMismatch | query flags, timestamps or checksums don't number one per short channel id |
| EncodeInvalidAddresses |
|
Instances
| NFData EncodeError Source # | |||||
Defined in Lightning.Protocol.BOLT7.Codec Methods rnf :: EncodeError -> () # | |||||
| Generic EncodeError Source # | |||||
Defined in Lightning.Protocol.BOLT7.Codec Associated Types
| |||||
| Show EncodeError Source # | |||||
Defined in Lightning.Protocol.BOLT7.Codec Methods showsPrec :: Int -> EncodeError -> ShowS # show :: EncodeError -> String # showList :: [EncodeError] -> ShowS # | |||||
| Eq EncodeError Source # | |||||
Defined in Lightning.Protocol.BOLT7.Codec | |||||
| type Rep EncodeError Source # | |||||
Defined in Lightning.Protocol.BOLT7.Codec type Rep EncodeError = D1 ('MetaData "EncodeError" "Lightning.Protocol.BOLT7.Codec" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'False) ((C1 ('MetaCons "EncodeLengthOverflow" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "EncodeInvalidTlvs" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "EncodeCountMismatch" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "EncodeInvalidAddresses" 'PrefixI 'False) (U1 :: Type -> Type))) | |||||
data DecodeError Source #
Why a message failed to decode.
Constructors
| DecodeInsufficientBytes | the input ended before a field did |
| DecodeInvalidPoint | a point lacks a compressed-encoding prefix (0x02 or 0x03) |
| DecodeInvalidAmount | an amount exceeds 21 million BTC |
| DecodeInvalidBool | a boolean byte is neither 0 nor 1 |
| DecodeInvalidShortChannelIds |
|
| DecodeUnknownEncoding !Word8 | an encoded array uses an unknown encoding type (type 1, zlib, is no longer allowed) |
| DecodeCountMismatch | query flags, timestamps or checksums don't number one per short channel id |
| DecodeTlvError !TlvError | the message's TLV stream is malformed |
| DecodeInvalidTlvValue !Word64 | a known TLV record (of the given type) has a malformed value |
| DecodeUnknownType !Word16 | the message type is not one of BOLT #7's |
Instances
| NFData DecodeError Source # | |||||
Defined in Lightning.Protocol.BOLT7.Codec Methods rnf :: DecodeError -> () # | |||||
| Generic DecodeError Source # | |||||
Defined in Lightning.Protocol.BOLT7.Codec Associated Types
| |||||
| Show DecodeError Source # | |||||
Defined in Lightning.Protocol.BOLT7.Codec Methods showsPrec :: Int -> DecodeError -> ShowS # show :: DecodeError -> String # showList :: [DecodeError] -> ShowS # | |||||
| Eq DecodeError Source # | |||||
Defined in Lightning.Protocol.BOLT7.Codec | |||||
| type Rep DecodeError Source # | |||||
Defined in Lightning.Protocol.BOLT7.Codec type Rep DecodeError = D1 ('MetaData "DecodeError" "Lightning.Protocol.BOLT7.Codec" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'False) (((C1 ('MetaCons "DecodeInsufficientBytes" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DecodeInvalidPoint" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "DecodeInvalidAmount" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "DecodeInvalidBool" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DecodeInvalidShortChannelIds" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "DecodeUnknownEncoding" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8)) :+: C1 ('MetaCons "DecodeCountMismatch" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "DecodeTlvError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TlvError)) :+: (C1 ('MetaCons "DecodeInvalidTlvValue" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)) :+: C1 ('MetaCons "DecodeUnknownType" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word16)))))) | |||||
Payloads
encode_channel_announcement :: ChannelAnnouncement -> Either EncodeError ByteString Source #
Encode a ChannelAnnouncement payload. Fails if the features exceed
65535 bytes.
decode_channel_announcement :: ByteString -> Either DecodeError ChannelAnnouncement Source #
Decode a ChannelAnnouncement payload.
encode_node_announcement :: NodeAnnouncement -> Either EncodeError ByteString Source #
Encode a NodeAnnouncement payload. Fails if the features or the
addresses exceed 65535 bytes, or if na_unknown_addresses begins
with a descriptor of a known type.
decode_node_announcement :: ByteString -> Either DecodeError NodeAnnouncement Source #
Decode a NodeAnnouncement payload.
Address descriptors are parsed up to the first one of an unknown
type; it and the bytes after it are kept in na_unknown_addresses.
A truncated descriptor of a known type is an error.
encode_channel_update :: ChannelUpdate -> ByteString Source #
Encode a ChannelUpdate payload.
decode_channel_update :: ByteString -> Either DecodeError ChannelUpdate Source #
Decode a ChannelUpdate payload.
htlc_maximum_msat is always present; the must_be_one bit of
message_flags is kept but not interpreted.
encode_announcement_signatures :: AnnouncementSignatures -> ByteString Source #
Encode an AnnouncementSignatures payload.
decode_announcement_signatures :: ByteString -> Either DecodeError AnnouncementSignatures Source #
Decode an AnnouncementSignatures payload.
encode_query_short_channel_ids :: QueryShortChannelIds -> Either EncodeError ByteString Source #
Encode a QueryShortChannelIds payload. Fails if the short channel
ids exceed the u16 length limit (8191 of them), if the query flags
don't number one per short channel id, or if qsci_tlvs holds a
record of type 1.
decode_query_short_channel_ids :: ByteString -> Either DecodeError QueryShortChannelIds Source #
Decode a QueryShortChannelIds payload.
Fails on an unknown encoding type (including the deprecated zlib
encoding), on encoded_short_ids that isn't a whole number of short
channel ids, and on query flags that don't number one per short
channel id.
>>>let zlib = BS.replicate 32 0 <> "\NUL\STX\SOHx">>>decode_query_short_channel_ids zlibLeft (DecodeUnknownEncoding 1)
encode_reply_short_channel_ids_end :: ReplyShortChannelIdsEnd -> ByteString Source #
Encode a ReplyShortChannelIdsEnd payload.
decode_reply_short_channel_ids_end :: ByteString -> Either DecodeError ReplyShortChannelIdsEnd Source #
Decode a ReplyShortChannelIdsEnd payload.
>>>decode_reply_short_channel_ids_end (BS.replicate 32 0 <> "\STX")Left DecodeInvalidBool
encode_query_channel_range :: QueryChannelRange -> Either EncodeError ByteString Source #
Encode a QueryChannelRange payload. Fails if qcr_tlvs holds a
record of type 1.
decode_query_channel_range :: ByteString -> Either DecodeError QueryChannelRange Source #
Decode a QueryChannelRange payload.
encode_reply_channel_range :: ReplyChannelRange -> Either EncodeError ByteString Source #
Encode a ReplyChannelRange payload. Fails if the short channel ids
exceed the u16 length limit (8191 of them), if the timestamps or
checksums don't number one per short channel id, or if rcr_tlvs
holds a record of type 1 or 3.
decode_reply_channel_range :: ByteString -> Either DecodeError ReplyChannelRange Source #
Decode a ReplyChannelRange payload.
Fails on an unknown encoding type (including the deprecated zlib
encoding), on encoded_short_ids that isn't a whole number of short
channel ids, and on timestamps or checksums that don't number one
per short channel id.
encode_gossip_timestamp_filter :: GossipTimestampFilter -> ByteString Source #
Encode a GossipTimestampFilter payload.
decode_gossip_timestamp_filter :: ByteString -> Either DecodeError GossipTimestampFilter Source #
Decode a GossipTimestampFilter payload.
Signatures and checksums
channel_announcement_hash :: ChannelAnnouncement -> Either EncodeError ByteString Source #
The digest the four signatures of a ChannelAnnouncement sign: the
double SHA-256 of its encoding from offset 256 (after the
signatures) to the end. Fails as encode_channel_announcement does.
node_announcement_hash :: NodeAnnouncement -> Either EncodeError ByteString Source #
The digest the signature of a NodeAnnouncement signs: the double
SHA-256 of its encoding after the signature. Fails as
encode_node_announcement does.
channel_update_hash :: ChannelUpdate -> ByteString Source #
The digest the signature of a ChannelUpdate signs: the double
SHA-256 of its encoding after the signature.
verify_channel_announcement :: ChannelAnnouncement -> Bool Source #
Verify the four signatures of a ChannelAnnouncement: both node
signatures and both bitcoin signatures, each over
channel_announcement_hash under the corresponding key.
As with libsecp256k1, signatures must be in low-s form. A key that isn't a point on the curve fails verification.
verify_node_announcement :: NodeAnnouncement -> Bool Source #
Verify the signature of a NodeAnnouncement under its node id.
As with libsecp256k1, the signature must be in low-s form.
verify_channel_update :: Point -> ChannelUpdate -> Bool Source #
Verify the signature of a ChannelUpdate under the given node id.
The key is that of the channel's ChannelAnnouncement selected by
the update's direction: ca_node_id_1 for
NodeOne, ca_node_id_2 for
NodeTwo. As with libsecp256k1, the
signature must be in low-s form.
channel_update_checksum :: ChannelUpdate -> Word32 Source #
The checksum of a ChannelUpdate, as used in the checksums_tlv of
reply_channel_range: the CRC-32C (RFC 3720) of the update without
its signature and timestamp. Extension records are included.
Validation
data ValidationError Source #
A rule a message breaks.
Constructors
| ValidateNodeIdOrdering |
|
| ValidateMultipleDns | more than one DNS hostname descriptor |
| ValidateHtlcAmounts |
|
| ValidateZeroBlocks |
|
| ValidateBlockOverflow | the block range extends past block 2^32 - 1 |
| ValidateScidNotAscending | short channel ids are not in strictly ascending order |
Instances
| NFData ValidationError Source # | |||||
Defined in Lightning.Protocol.BOLT7.Validate Methods rnf :: ValidationError -> () # | |||||
| Generic ValidationError Source # | |||||
Defined in Lightning.Protocol.BOLT7.Validate Associated Types
Methods from :: ValidationError -> Rep ValidationError x # to :: Rep ValidationError x -> ValidationError # | |||||
| Show ValidationError Source # | |||||
Defined in Lightning.Protocol.BOLT7.Validate Methods showsPrec :: Int -> ValidationError -> ShowS # show :: ValidationError -> String # showList :: [ValidationError] -> ShowS # | |||||
| Eq ValidationError Source # | |||||
Defined in Lightning.Protocol.BOLT7.Validate Methods (==) :: ValidationError -> ValidationError -> Bool # (/=) :: ValidationError -> ValidationError -> Bool # | |||||
| type Rep ValidationError Source # | |||||
Defined in Lightning.Protocol.BOLT7.Validate type Rep ValidationError = D1 ('MetaData "ValidationError" "Lightning.Protocol.BOLT7.Validate" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'False) ((C1 ('MetaCons "ValidateNodeIdOrdering" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ValidateMultipleDns" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ValidateHtlcAmounts" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "ValidateZeroBlocks" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ValidateBlockOverflow" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ValidateScidNotAscending" 'PrefixI 'False) (U1 :: Type -> Type)))) | |||||
validate_channel_announcement :: ChannelAnnouncement -> Either ValidationError () Source #
Check that node_id_1 is lexicographically less than node_id_2;
a receiver must ignore the message otherwise.
Signatures and feature bits are not checked here; see
verify_channel_announcement and
ppad-bolt9's validate_remote.
validate_node_announcement :: NodeAnnouncement -> Either ValidationError () Source #
Check that at most one DNS hostname is announced; a receiver must not forward the message otherwise.
Descriptors a receiver should merely ignore (Tor v2, port 0, a
hostname that isn't ASCII) are left to
usable_addresses.
validate_channel_update :: ChannelUpdate -> Either ValidationError () Source #
Check that htlc_minimum_msat does not exceed htlc_maximum_msat;
a receiver should not route through the channel otherwise.
validate_query_short_channel_ids :: QueryShortChannelIds -> Either ValidationError () Source #
Check that the short channel ids are in strictly ascending order, as their encoding requires.
validate_query_channel_range :: QueryChannelRange -> Either ValidationError () Source #
Check that number_of_blocks is at least 1, as the sender must
ensure, and that the range ends at or before block 2^32 - 1 (a
library rule: such a range can't be represented).
validate_reply_channel_range :: ReplyChannelRange -> Either ValidationError () Source #
Check that the short channel ids are in strictly ascending order, as their encoding requires.
channel_update flags
newtype MessageFlags Source #
The message_flags byte of a channel_update: bit 0 is
must_be_one, bit 1 is dont_forward, and the other bits are
unassigned. Every byte is a valid value; unassigned bits are kept so
that re-encoding reproduces the signed bytes.
Constructors
| MessageFlags Word8 |
Instances
| NFData MessageFlags Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods rnf :: MessageFlags -> () # | |||||
| Generic MessageFlags Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Associated Types
| |||||
| Show MessageFlags Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods showsPrec :: Int -> MessageFlags -> ShowS # show :: MessageFlags -> String # showList :: [MessageFlags] -> ShowS # | |||||
| Eq MessageFlags Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types | |||||
| type Rep MessageFlags Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types type Rep MessageFlags = D1 ('MetaData "MessageFlags" "Lightning.Protocol.BOLT7.Types" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'True) (C1 ('MetaCons "MessageFlags" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word8))) | |||||
data Forwarding Source #
Whether a channel_update may be relayed to other peers (the
dont_forward bit).
Constructors
| Forward |
|
| DontForward |
|
Instances
| NFData Forwarding Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods rnf :: Forwarding -> () # | |||||
| Generic Forwarding Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Associated Types
| |||||
| Show Forwarding Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods showsPrec :: Int -> Forwarding -> ShowS # show :: Forwarding -> String # showList :: [Forwarding] -> ShowS # | |||||
| Eq Forwarding Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types | |||||
| Ord Forwarding Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods compare :: Forwarding -> Forwarding -> Ordering # (<) :: Forwarding -> Forwarding -> Bool # (<=) :: Forwarding -> Forwarding -> Bool # (>) :: Forwarding -> Forwarding -> Bool # (>=) :: Forwarding -> Forwarding -> Bool # max :: Forwarding -> Forwarding -> Forwarding # min :: Forwarding -> Forwarding -> Forwarding # | |||||
| type Rep Forwarding Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types | |||||
message_flags :: Forwarding -> MessageFlags Source #
The MessageFlags an origin node sets: must_be_one set, the given
dont_forward bit, and no unassigned bits.
>>>message_flags DontForwardMessageFlags 3
message_flags_forwarding :: MessageFlags -> Forwarding Source #
The dont_forward bit of MessageFlags.
>>>message_flags_forwarding (MessageFlags 0x01)Forward
has_must_be_one :: MessageFlags -> Bool Source #
Whether the must_be_one bit is set. Senders must set it; receivers
ignore it.
>>>has_must_be_one (MessageFlags 0x00)False
newtype ChannelFlags Source #
The channel_flags byte of a channel_update: bit 0 is
direction, bit 1 is disable, and the other bits are unassigned.
Every byte is a valid value; unassigned bits are kept so that
re-encoding reproduces the signed bytes.
Constructors
| ChannelFlags Word8 |
Instances
| NFData ChannelFlags Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods rnf :: ChannelFlags -> () # | |||||
| Generic ChannelFlags Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Associated Types
| |||||
| Show ChannelFlags Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods showsPrec :: Int -> ChannelFlags -> ShowS # show :: ChannelFlags -> String # showList :: [ChannelFlags] -> ShowS # | |||||
| Eq ChannelFlags Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types | |||||
| type Rep ChannelFlags Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types type Rep ChannelFlags = D1 ('MetaData "ChannelFlags" "Lightning.Protocol.BOLT7.Types" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'True) (C1 ('MetaCons "ChannelFlags" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word8))) | |||||
The node a channel_update originates from.
Instances
| NFData Direction Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types | |||||
| Generic Direction Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Associated Types
| |||||
| Show Direction Source # | |||||
| Eq Direction Source # | |||||
| Ord Direction Source # | |||||
| type Rep Direction Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types | |||||
data ChannelStatus Source #
Whether a channel direction is usable.
Instances
| NFData ChannelStatus Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods rnf :: ChannelStatus -> () # | |||||
| Generic ChannelStatus Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Associated Types
| |||||
| Show ChannelStatus Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods showsPrec :: Int -> ChannelStatus -> ShowS # show :: ChannelStatus -> String # showList :: [ChannelStatus] -> ShowS # | |||||
| Eq ChannelStatus Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods (==) :: ChannelStatus -> ChannelStatus -> Bool # (/=) :: ChannelStatus -> ChannelStatus -> Bool # | |||||
| Ord ChannelStatus Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods compare :: ChannelStatus -> ChannelStatus -> Ordering # (<) :: ChannelStatus -> ChannelStatus -> Bool # (<=) :: ChannelStatus -> ChannelStatus -> Bool # (>) :: ChannelStatus -> ChannelStatus -> Bool # (>=) :: ChannelStatus -> ChannelStatus -> Bool # max :: ChannelStatus -> ChannelStatus -> ChannelStatus # min :: ChannelStatus -> ChannelStatus -> ChannelStatus # | |||||
| type Rep ChannelStatus Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types | |||||
channel_flags :: Direction -> ChannelStatus -> ChannelFlags Source #
The ChannelFlags for the given direction and status, with no
unassigned bits set.
>>>channel_flags NodeTwo DisabledChannelFlags 3
channel_flags_direction :: ChannelFlags -> Direction Source #
The direction bit of ChannelFlags.
>>>channel_flags_direction (ChannelFlags 0x05)NodeTwo
channel_flags_status :: ChannelFlags -> ChannelStatus Source #
The disable bit of ChannelFlags.
>>>channel_flags_status (ChannelFlags 0x02)Disabled
node_announcement fields
A node's colour: red, green and blue.
Instances
| NFData RgbColor Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types | |||||
| Generic RgbColor Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Associated Types
| |||||
| Show RgbColor Source # | |||||
| Eq RgbColor Source # | |||||
| type Rep RgbColor Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types type Rep RgbColor = D1 ('MetaData "RgbColor" "Lightning.Protocol.BOLT7.Types" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'False) (C1 ('MetaCons "RgbColor" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word8) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word8) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word8)))) | |||||
A 32-byte node alias. Origin nodes should use UTF-8 padded with zero bytes, but receivers must accept any bytes.
Instances
| NFData Alias Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types | |||||
| Generic Alias Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Associated Types
| |||||
| Show Alias Source # | |||||
| Eq Alias Source # | |||||
| type Rep Alias Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types type Rep Alias = D1 ('MetaData "Alias" "Lightning.Protocol.BOLT7.Types" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'True) (C1 ('MetaCons "Alias" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
alias :: ByteString -> Maybe Alias Source #
Construct an Alias from exactly 32 bytes.
>>>alias "too short"Nothing
Addresses
An address descriptor of a known type, with its port where it has one.
Constructors
| AddrIPv4 !IPv4Addr !Word16 | type 1 |
| AddrIPv6 !IPv6Addr !Word16 | type 2 |
| AddrTorV2 !TorV2Addr | type 3 (deprecated) |
| AddrTorV3 !TorV3Addr !Word16 | type 4 |
| AddrDNS !Hostname !Word16 | type 5 |
Instances
| NFData Address Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types | |||||
| Generic Address Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Associated Types
| |||||
| Show Address Source # | |||||
| Eq Address Source # | |||||
| type Rep Address Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types type Rep Address = D1 ('MetaData "Address" "Lightning.Protocol.BOLT7.Types" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'False) ((C1 ('MetaCons "AddrIPv4" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 IPv4Addr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word16)) :+: C1 ('MetaCons "AddrIPv6" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 IPv6Addr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word16))) :+: (C1 ('MetaCons "AddrTorV2" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TorV2Addr)) :+: (C1 ('MetaCons "AddrTorV3" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TorV3Addr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word16)) :+: C1 ('MetaCons "AddrDNS" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Hostname) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word16))))) | |||||
usable_addresses :: [Address] -> [Address] Source #
The addresses a receiver should connect to, per the BOLT #7 receiver rules: drops Tor v2 descriptors, descriptors with port 0, DNS hostnames that are empty or not ASCII, and every DNS descriptor after the first.
A 4-byte IPv4 address.
Instances
| NFData IPv4Addr Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types | |||||
| Generic IPv4Addr Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Associated Types
| |||||
| Show IPv4Addr Source # | |||||
| Eq IPv4Addr Source # | |||||
| type Rep IPv4Addr Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types type Rep IPv4Addr = D1 ('MetaData "IPv4Addr" "Lightning.Protocol.BOLT7.Types" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'True) (C1 ('MetaCons "IPv4Addr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
ipv4_addr :: ByteString -> Maybe IPv4Addr Source #
Construct an IPv4Addr from exactly 4 bytes.
>>>ipv4_addr "\127\NUL\NUL\SOH"Just (IPv4Addr "\DEL\NUL\NUL\SOH")
un_ipv4_addr :: IPv4Addr -> ByteString Source #
The bytes of an IPv4Addr.
A 16-byte IPv6 address.
Instances
| NFData IPv6Addr Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types | |||||
| Generic IPv6Addr Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Associated Types
| |||||
| Show IPv6Addr Source # | |||||
| Eq IPv6Addr Source # | |||||
| type Rep IPv6Addr Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types type Rep IPv6Addr = D1 ('MetaData "IPv6Addr" "Lightning.Protocol.BOLT7.Types" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'True) (C1 ('MetaCons "IPv6Addr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
un_ipv6_addr :: IPv6Addr -> ByteString Source #
The bytes of an IPv6Addr.
The 12 data bytes of a deprecated Tor v2 address descriptor (type 3). They are kept, uninterpreted, so that re-encoding reproduces the signed bytes.
Instances
| NFData TorV2Addr Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types | |||||
| Generic TorV2Addr Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Associated Types
| |||||
| Show TorV2Addr Source # | |||||
| Eq TorV2Addr Source # | |||||
| type Rep TorV2Addr Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types type Rep TorV2Addr = D1 ('MetaData "TorV2Addr" "Lightning.Protocol.BOLT7.Types" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'True) (C1 ('MetaCons "TorV2Addr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
tor_v2_addr :: ByteString -> Maybe TorV2Addr Source #
Construct a TorV2Addr from exactly 12 bytes.
un_tor_v2_addr :: TorV2Addr -> ByteString Source #
The bytes of a TorV2Addr.
A 35-byte Tor v3 onion service address: a 32-byte ed25519 public key, a 2-byte checksum and a 1-byte version.
Instances
| NFData TorV3Addr Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types | |||||
| Generic TorV3Addr Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Associated Types
| |||||
| Show TorV3Addr Source # | |||||
| Eq TorV3Addr Source # | |||||
| type Rep TorV3Addr Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types type Rep TorV3Addr = D1 ('MetaData "TorV3Addr" "Lightning.Protocol.BOLT7.Types" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'True) (C1 ('MetaCons "TorV3Addr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
tor_v3_addr :: ByteString -> Maybe TorV3Addr Source #
Construct a TorV3Addr from exactly 35 bytes.
un_tor_v3_addr :: TorV3Addr -> ByteString Source #
The bytes of a TorV3Addr.
A DNS hostname of at most 255 bytes (the limit of its length byte).
BOLT #7 requires hostnames to be ASCII, with other characters
Punycode-encoded, but receivers keep whatever bytes they are given;
see is_ascii_hostname.
Instances
| NFData Hostname Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types | |||||
| Generic Hostname Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Associated Types
| |||||
| Show Hostname Source # | |||||
| Eq Hostname Source # | |||||
| type Rep Hostname Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types type Rep Hostname = D1 ('MetaData "Hostname" "Lightning.Protocol.BOLT7.Types" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'True) (C1 ('MetaCons "Hostname" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
hostname :: ByteString -> Maybe Hostname Source #
Construct a Hostname from at most 255 bytes.
>>>hostname "ln.example.com"Just (Hostname "ln.example.com")>>>hostname (BS.replicate 256 0x61)Nothing
un_hostname :: Hostname -> ByteString Source #
The bytes of a Hostname.
is_ascii_hostname :: Hostname -> Bool Source #
Whether a Hostname is non-empty and ASCII, as BOLT #7 requires.
>>>fmap is_ascii_hostname (hostname "caf\233")Just False
Query fields
newtype QueryFlags Source #
A query_flags bitfield, sent for each short channel id in a
query_short_channel_ids. Every value is valid; unassigned bits are
kept.
Constructors
| QueryFlags Word64 |
Instances
| NFData QueryFlags Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods rnf :: QueryFlags -> () # | |||||
| Generic QueryFlags Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Associated Types
| |||||
| Show QueryFlags Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods showsPrec :: Int -> QueryFlags -> ShowS # show :: QueryFlags -> String # showList :: [QueryFlags] -> ShowS # | |||||
| Eq QueryFlags Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types | |||||
| type Rep QueryFlags Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types type Rep QueryFlags = D1 ('MetaData "QueryFlags" "Lightning.Protocol.BOLT7.Types" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'True) (C1 ('MetaCons "QueryFlags" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64))) | |||||
The assigned bits of QueryFlags.
Constructors
| WantChannelAnnouncement | bit 0 |
| WantChannelUpdate1 | bit 1: the |
| WantChannelUpdate2 | bit 2: the |
| WantNodeAnnouncement1 | bit 3: the |
| WantNodeAnnouncement2 | bit 4: the |
Instances
| NFData QueryFlag Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types | |||||
| Bounded QueryFlag Source # | |||||
| Enum QueryFlag Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods succ :: QueryFlag -> QueryFlag # pred :: QueryFlag -> QueryFlag # fromEnum :: QueryFlag -> Int # enumFrom :: QueryFlag -> [QueryFlag] # enumFromThen :: QueryFlag -> QueryFlag -> [QueryFlag] # enumFromTo :: QueryFlag -> QueryFlag -> [QueryFlag] # enumFromThenTo :: QueryFlag -> QueryFlag -> QueryFlag -> [QueryFlag] # | |||||
| Generic QueryFlag Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Associated Types
| |||||
| Show QueryFlag Source # | |||||
| Eq QueryFlag Source # | |||||
| Ord QueryFlag Source # | |||||
| type Rep QueryFlag Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types type Rep QueryFlag = D1 ('MetaData "QueryFlag" "Lightning.Protocol.BOLT7.Types" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'False) ((C1 ('MetaCons "WantChannelAnnouncement" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WantChannelUpdate1" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "WantChannelUpdate2" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "WantNodeAnnouncement1" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WantNodeAnnouncement2" 'PrefixI 'False) (U1 :: Type -> Type)))) | |||||
query_flags :: [QueryFlag] -> QueryFlags Source #
The QueryFlags with exactly the given bits set.
>>>query_flags [WantChannelAnnouncement, WantChannelUpdate2]QueryFlags 5
has_query_flag :: QueryFlag -> QueryFlags -> Bool Source #
Whether the given bit is set.
>>>has_query_flag WantChannelUpdate1 (QueryFlags 2)True
newtype QueryOption Source #
The query_option_flags bitfield of a query_channel_range. Every
value is valid; unassigned bits are kept.
Constructors
| QueryOption Word64 |
Instances
| NFData QueryOption Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods rnf :: QueryOption -> () # | |||||
| Generic QueryOption Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Associated Types
| |||||
| Show QueryOption Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods showsPrec :: Int -> QueryOption -> ShowS # show :: QueryOption -> String # showList :: [QueryOption] -> ShowS # | |||||
| Eq QueryOption Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types | |||||
| type Rep QueryOption Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types type Rep QueryOption = D1 ('MetaData "QueryOption" "Lightning.Protocol.BOLT7.Types" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'True) (C1 ('MetaCons "QueryOption" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64))) | |||||
data QueryOptionFlag Source #
The assigned bits of QueryOption.
Constructors
| WantTimestamps | bit 0 |
| WantChecksums | bit 1 |
Instances
| NFData QueryOptionFlag Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods rnf :: QueryOptionFlag -> () # | |||||
| Bounded QueryOptionFlag Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types | |||||
| Enum QueryOptionFlag Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods succ :: QueryOptionFlag -> QueryOptionFlag # pred :: QueryOptionFlag -> QueryOptionFlag # toEnum :: Int -> QueryOptionFlag # fromEnum :: QueryOptionFlag -> Int # enumFrom :: QueryOptionFlag -> [QueryOptionFlag] # enumFromThen :: QueryOptionFlag -> QueryOptionFlag -> [QueryOptionFlag] # enumFromTo :: QueryOptionFlag -> QueryOptionFlag -> [QueryOptionFlag] # enumFromThenTo :: QueryOptionFlag -> QueryOptionFlag -> QueryOptionFlag -> [QueryOptionFlag] # | |||||
| Generic QueryOptionFlag Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Associated Types
Methods from :: QueryOptionFlag -> Rep QueryOptionFlag x # to :: Rep QueryOptionFlag x -> QueryOptionFlag # | |||||
| Show QueryOptionFlag Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods showsPrec :: Int -> QueryOptionFlag -> ShowS # show :: QueryOptionFlag -> String # showList :: [QueryOptionFlag] -> ShowS # | |||||
| Eq QueryOptionFlag Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods (==) :: QueryOptionFlag -> QueryOptionFlag -> Bool # (/=) :: QueryOptionFlag -> QueryOptionFlag -> Bool # | |||||
| Ord QueryOptionFlag Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods compare :: QueryOptionFlag -> QueryOptionFlag -> Ordering # (<) :: QueryOptionFlag -> QueryOptionFlag -> Bool # (<=) :: QueryOptionFlag -> QueryOptionFlag -> Bool # (>) :: QueryOptionFlag -> QueryOptionFlag -> Bool # (>=) :: QueryOptionFlag -> QueryOptionFlag -> Bool # max :: QueryOptionFlag -> QueryOptionFlag -> QueryOptionFlag # min :: QueryOptionFlag -> QueryOptionFlag -> QueryOptionFlag # | |||||
| type Rep QueryOptionFlag Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types | |||||
query_option :: [QueryOptionFlag] -> QueryOption Source #
The QueryOption with exactly the given bits set.
>>>query_option [WantTimestamps, WantChecksums]QueryOption 3
has_query_option :: QueryOptionFlag -> QueryOption -> Bool Source #
Whether the given bit is set.
>>>has_query_option WantChecksums (QueryOption 1)False
data ChannelUpdateTimestamps Source #
The timestamps of a channel's latest channel_updates, from
node_id_1 and node_id_2 (0 where there is none).
Constructors
| ChannelUpdateTimestamps !Word32 !Word32 |
Instances
| NFData ChannelUpdateTimestamps Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods rnf :: ChannelUpdateTimestamps -> () # | |||||
| Generic ChannelUpdateTimestamps Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Associated Types
Methods from :: ChannelUpdateTimestamps -> Rep ChannelUpdateTimestamps x # to :: Rep ChannelUpdateTimestamps x -> ChannelUpdateTimestamps # | |||||
| Show ChannelUpdateTimestamps Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods showsPrec :: Int -> ChannelUpdateTimestamps -> ShowS # show :: ChannelUpdateTimestamps -> String # showList :: [ChannelUpdateTimestamps] -> ShowS # | |||||
| Eq ChannelUpdateTimestamps Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods (==) :: ChannelUpdateTimestamps -> ChannelUpdateTimestamps -> Bool # (/=) :: ChannelUpdateTimestamps -> ChannelUpdateTimestamps -> Bool # | |||||
| type Rep ChannelUpdateTimestamps Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types type Rep ChannelUpdateTimestamps = D1 ('MetaData "ChannelUpdateTimestamps" "Lightning.Protocol.BOLT7.Types" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'False) (C1 ('MetaCons "ChannelUpdateTimestamps" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32))) | |||||
data ChannelUpdateChecksums Source #
The checksums of a channel's latest channel_updates, from
node_id_1 and node_id_2 (0 where there is none).
Constructors
| ChannelUpdateChecksums !Word32 !Word32 |
Instances
| NFData ChannelUpdateChecksums Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods rnf :: ChannelUpdateChecksums -> () # | |||||
| Generic ChannelUpdateChecksums Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Associated Types
Methods from :: ChannelUpdateChecksums -> Rep ChannelUpdateChecksums x # to :: Rep ChannelUpdateChecksums x -> ChannelUpdateChecksums # | |||||
| Show ChannelUpdateChecksums Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods showsPrec :: Int -> ChannelUpdateChecksums -> ShowS # show :: ChannelUpdateChecksums -> String # showList :: [ChannelUpdateChecksums] -> ShowS # | |||||
| Eq ChannelUpdateChecksums Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types Methods (==) :: ChannelUpdateChecksums -> ChannelUpdateChecksums -> Bool # (/=) :: ChannelUpdateChecksums -> ChannelUpdateChecksums -> Bool # | |||||
| type Rep ChannelUpdateChecksums Source # | |||||
Defined in Lightning.Protocol.BOLT7.Types type Rep ChannelUpdateChecksums = D1 ('MetaData "ChannelUpdateChecksums" "Lightning.Protocol.BOLT7.Types" "ppad-bolt7-0.1.1-LkNbqSjp5I6927WSU3Yi65" 'False) (C1 ('MetaCons "ChannelUpdateChecksums" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32))) | |||||
Short channel ids
format_short_channel_id :: ShortChannelId -> String Source #
Render a short channel id in the human-readable format of BOLT #7:
block height, transaction index and output index, in decimal,
separated by x.
>>>fmap format_short_channel_id (short_channel_id 539268 845 1)Just "539268x845x1"