| Copyright | (c) 2025 Jared Tobin |
|---|---|
| License | MIT |
| Maintainer | Jared Tobin <jared@ppad.tech> |
| Safe Haskell | None |
| Language | Haskell2010 |
Lightning.Protocol.BOLT2.Types
Description
Core types for BOLT #2 peer protocol.
This module provides newtypes for identifiers, amounts, hashes, and keys used in the Lightning Network peer protocol.
Synopsis
- data ChannelId
- channelId :: ByteString -> Maybe ChannelId
- unChannelId :: ChannelId -> ByteString
- newtype Satoshis = Satoshis {
- unSatoshis :: Word64
- newtype MilliSatoshis = MilliSatoshis {}
- satoshisToMsat :: Satoshis -> MilliSatoshis
- msatToSatoshis :: MilliSatoshis -> Satoshis
- data Signature
- signature :: ByteString -> Maybe Signature
- unSignature :: Signature -> ByteString
- data Point
- point :: ByteString -> Maybe Point
- unPoint :: Point -> ByteString
- data PaymentHash
- paymentHash :: ByteString -> Maybe PaymentHash
- unPaymentHash :: PaymentHash -> ByteString
- data PaymentPreimage
- paymentPreimage :: ByteString -> Maybe PaymentPreimage
- unPaymentPreimage :: PaymentPreimage -> ByteString
- data Secret
- secret :: ByteString -> Maybe Secret
- unSecret :: Secret -> ByteString
- data TxId
- txId :: ByteString -> Maybe TxId
- unTxId :: TxId -> ByteString
- data Outpoint = Outpoint {
- outpointTxId :: !TxId
- outpointVout :: !Word32
- data ScriptPubKey
- scriptPubKey :: ByteString -> ScriptPubKey
- unScriptPubKey :: ScriptPubKey -> ByteString
- data ChainHash
- chainHash :: ByteString -> Maybe ChainHash
- unChainHash :: ChainHash -> ByteString
- data ShortChannelId = ShortChannelId {}
- shortChannelId :: Word32 -> Word32 -> Word16 -> Maybe ShortChannelId
- scidBlockHeight :: ShortChannelId -> Word32
- scidTxIndex :: ShortChannelId -> Word32
- scidOutputIndex :: ShortChannelId -> Word16
- data FeatureBits
- featureBits :: ByteString -> FeatureBits
- unFeatureBits :: FeatureBits -> ByteString
- data OnionPacket
- onionPacket :: ByteString -> Maybe OnionPacket
- unOnionPacket :: OnionPacket -> ByteString
- channelIdLen :: Int
- signatureLen :: Int
- pointLen :: Int
- txIdLen :: Int
- chainHashLen :: Int
- shortChannelIdLen :: Int
- paymentHashLen :: Int
- paymentPreimageLen :: Int
- onionPacketLen :: Int
- secretLen :: Int
Identifiers
A 32-byte channel identifier.
Derived from the funding transaction by XORing funding_txid with
funding_output_index (big-endian, altering the last 2 bytes).
For v2 channels, derived as SHA256(lesser-revocation-basepoint ||
greater-revocation-basepoint).
Instances
| NFData ChannelId Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types | |||||
| Generic ChannelId Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Associated Types
| |||||
| Show ChannelId Source # | |||||
| Eq ChannelId Source # | |||||
| Ord ChannelId Source # | |||||
| type Rep ChannelId Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types type Rep ChannelId = D1 ('MetaData "ChannelId" "Lightning.Protocol.BOLT2.Types" "ppad-bolt2-0.0.1-GZp2eCd2tiE8fNOn3OFks8" 'True) (C1 ('MetaCons "ChannelId" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
channelId :: ByteString -> Maybe ChannelId Source #
Construct a ChannelId from a 32-byte ByteString.
Returns Nothing if the input is not exactly 32 bytes.
>>>channelId (BS.replicate 32 0x00)Just (ChannelId ...)>>>channelId (BS.replicate 31 0x00)Nothing
unChannelId :: ChannelId -> ByteString Source #
Extract the underlying ByteString from a ChannelId.
Amounts
Amount in satoshis (1/100,000,000 of a bitcoin).
Stored as a Word64. Maximum valid value is 21,000,000 * 100,000,000
= 2,100,000,000,000,000 satoshis.
Constructors
| Satoshis | |
Fields
| |
Instances
| NFData Satoshis Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types | |||||
| Enum Satoshis Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types | |||||
| Generic Satoshis Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Associated Types
| |||||
| Num Satoshis Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types | |||||
| Integral Satoshis Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types | |||||
| Real Satoshis Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Methods toRational :: Satoshis -> Rational # | |||||
| Show Satoshis Source # | |||||
| Eq Satoshis Source # | |||||
| Ord Satoshis Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types | |||||
| type Rep Satoshis Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types | |||||
newtype MilliSatoshis Source #
Amount in millisatoshis (1/1000 of a satoshi).
Stored as a Word64. Used for HTLC amounts and channel balances.
Constructors
| MilliSatoshis | |
Fields | |
Instances
satoshisToMsat :: Satoshis -> MilliSatoshis Source #
Convert Satoshis to MilliSatoshis.
>>>satoshisToMsat (Satoshis 1)MilliSatoshis 1000
msatToSatoshis :: MilliSatoshis -> Satoshis Source #
Convert MilliSatoshis to Satoshis, rounding down.
>>>msatToSatoshis (MilliSatoshis 1500)Satoshis 1
Cryptographic types
A 64-byte compact ECDSA signature.
Used for commitment transaction signatures, HTLC signatures, and closing transaction signatures.
Instances
| NFData Signature Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types | |||||
| Generic Signature Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Associated Types
| |||||
| Show Signature Source # | |||||
| Eq Signature Source # | |||||
| Ord Signature Source # | |||||
| type Rep Signature Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types type Rep Signature = D1 ('MetaData "Signature" "Lightning.Protocol.BOLT2.Types" "ppad-bolt2-0.0.1-GZp2eCd2tiE8fNOn3OFks8" 'True) (C1 ('MetaCons "Signature" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
signature :: ByteString -> Maybe Signature Source #
Construct a Signature from a 64-byte ByteString.
Returns Nothing if the input is not exactly 64 bytes.
unSignature :: Signature -> ByteString Source #
Extract the underlying ByteString from a Signature.
A 33-byte compressed secp256k1 public key.
Used for funding pubkeys, basepoints, and per-commitment points.
Instances
| NFData Point Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types | |||||
| Generic Point Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Associated Types
| |||||
| Show Point Source # | |||||
| Eq Point Source # | |||||
| Ord Point Source # | |||||
| type Rep Point Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types type Rep Point = D1 ('MetaData "Point" "Lightning.Protocol.BOLT2.Types" "ppad-bolt2-0.0.1-GZp2eCd2tiE8fNOn3OFks8" 'True) (C1 ('MetaCons "Point" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
point :: ByteString -> Maybe Point Source #
Construct a Point from a 33-byte ByteString.
Returns Nothing if the input is not exactly 33 bytes.
Note: This only validates the length. Use secp256k1 libraries for full point validation.
unPoint :: Point -> ByteString Source #
Extract the underlying ByteString from a Point.
data PaymentHash Source #
A 32-byte SHA256 payment hash.
Used to identify HTLCs. The preimage that hashes to this value is required to claim the HTLC.
Instances
| NFData PaymentHash Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Methods rnf :: PaymentHash -> () # | |||||
| Generic PaymentHash Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Associated Types
| |||||
| Show PaymentHash Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Methods showsPrec :: Int -> PaymentHash -> ShowS # show :: PaymentHash -> String # showList :: [PaymentHash] -> ShowS # | |||||
| Eq PaymentHash Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types | |||||
| Ord PaymentHash Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Methods compare :: PaymentHash -> PaymentHash -> Ordering # (<) :: PaymentHash -> PaymentHash -> Bool # (<=) :: PaymentHash -> PaymentHash -> Bool # (>) :: PaymentHash -> PaymentHash -> Bool # (>=) :: PaymentHash -> PaymentHash -> Bool # max :: PaymentHash -> PaymentHash -> PaymentHash # min :: PaymentHash -> PaymentHash -> PaymentHash # | |||||
| type Rep PaymentHash Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types type Rep PaymentHash = D1 ('MetaData "PaymentHash" "Lightning.Protocol.BOLT2.Types" "ppad-bolt2-0.0.1-GZp2eCd2tiE8fNOn3OFks8" 'True) (C1 ('MetaCons "PaymentHash" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
paymentHash :: ByteString -> Maybe PaymentHash Source #
Construct a PaymentHash from a 32-byte ByteString.
Returns Nothing if the input is not exactly 32 bytes.
unPaymentHash :: PaymentHash -> ByteString Source #
Extract the underlying ByteString from a PaymentHash.
data PaymentPreimage Source #
A 32-byte payment preimage.
The SHA256 hash of this value produces the corresponding PaymentHash.
Knowledge of the preimage allows claiming an HTLC.
Instances
| NFData PaymentPreimage Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Methods rnf :: PaymentPreimage -> () # | |||||
| Generic PaymentPreimage Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Associated Types
Methods from :: PaymentPreimage -> Rep PaymentPreimage x # to :: Rep PaymentPreimage x -> PaymentPreimage # | |||||
| Show PaymentPreimage Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Methods showsPrec :: Int -> PaymentPreimage -> ShowS # show :: PaymentPreimage -> String # showList :: [PaymentPreimage] -> ShowS # | |||||
| Eq PaymentPreimage Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Methods (==) :: PaymentPreimage -> PaymentPreimage -> Bool # (/=) :: PaymentPreimage -> PaymentPreimage -> Bool # | |||||
| Ord PaymentPreimage Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Methods compare :: PaymentPreimage -> PaymentPreimage -> Ordering # (<) :: PaymentPreimage -> PaymentPreimage -> Bool # (<=) :: PaymentPreimage -> PaymentPreimage -> Bool # (>) :: PaymentPreimage -> PaymentPreimage -> Bool # (>=) :: PaymentPreimage -> PaymentPreimage -> Bool # max :: PaymentPreimage -> PaymentPreimage -> PaymentPreimage # min :: PaymentPreimage -> PaymentPreimage -> PaymentPreimage # | |||||
| type Rep PaymentPreimage Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types type Rep PaymentPreimage = D1 ('MetaData "PaymentPreimage" "Lightning.Protocol.BOLT2.Types" "ppad-bolt2-0.0.1-GZp2eCd2tiE8fNOn3OFks8" 'True) (C1 ('MetaCons "PaymentPreimage" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
paymentPreimage :: ByteString -> Maybe PaymentPreimage Source #
Construct a PaymentPreimage from a 32-byte ByteString.
Returns Nothing if the input is not exactly 32 bytes.
unPaymentPreimage :: PaymentPreimage -> ByteString Source #
Extract the underlying ByteString from a PaymentPreimage.
A 32-byte per-commitment secret.
Used in revoke_and_ack and channel_reestablish messages to revoke old commitment transactions.
Instances
| NFData Secret Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types | |||||
| Generic Secret Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Associated Types
| |||||
| Show Secret Source # | |||||
| Eq Secret Source # | |||||
| Ord Secret Source # | |||||
| type Rep Secret Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types type Rep Secret = D1 ('MetaData "Secret" "Lightning.Protocol.BOLT2.Types" "ppad-bolt2-0.0.1-GZp2eCd2tiE8fNOn3OFks8" 'True) (C1 ('MetaCons "Secret" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
secret :: ByteString -> Maybe Secret Source #
Construct a Secret from a 32-byte ByteString.
Returns Nothing if the input is not exactly 32 bytes.
unSecret :: Secret -> ByteString Source #
Extract the underlying ByteString from a Secret.
Transaction types
A 32-byte transaction identifier.
The double-SHA256 hash of a serialized transaction.
Instances
| NFData TxId Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types | |||||
| Generic TxId Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Associated Types
| |||||
| Show TxId Source # | |||||
| Eq TxId Source # | |||||
| Ord TxId Source # | |||||
| type Rep TxId Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types type Rep TxId = D1 ('MetaData "TxId" "Lightning.Protocol.BOLT2.Types" "ppad-bolt2-0.0.1-GZp2eCd2tiE8fNOn3OFks8" 'True) (C1 ('MetaCons "TxId" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
txId :: ByteString -> Maybe TxId Source #
Construct a TxId from a 32-byte ByteString.
Returns Nothing if the input is not exactly 32 bytes.
unTxId :: TxId -> ByteString Source #
Extract the underlying ByteString from a TxId.
A transaction outpoint (txid + output index).
Identifies a specific output of a transaction.
Constructors
| Outpoint | |
Fields
| |
Instances
| NFData Outpoint Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types | |||||
| Generic Outpoint Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Associated Types
| |||||
| Show Outpoint Source # | |||||
| Eq Outpoint Source # | |||||
| Ord Outpoint Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types | |||||
| type Rep Outpoint Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types type Rep Outpoint = D1 ('MetaData "Outpoint" "Lightning.Protocol.BOLT2.Types" "ppad-bolt2-0.0.1-GZp2eCd2tiE8fNOn3OFks8" 'False) (C1 ('MetaCons "Outpoint" 'PrefixI 'True) (S1 ('MetaSel ('Just "outpointTxId") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 TxId) :*: S1 ('MetaSel ('Just "outpointVout") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32))) | |||||
data ScriptPubKey Source #
A script pubkey (output script).
Variable length; used in shutdown messages, closing transactions, etc.
Instances
| NFData ScriptPubKey Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Methods rnf :: ScriptPubKey -> () # | |||||
| Generic ScriptPubKey Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Associated Types
| |||||
| Show ScriptPubKey Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Methods showsPrec :: Int -> ScriptPubKey -> ShowS # show :: ScriptPubKey -> String # showList :: [ScriptPubKey] -> ShowS # | |||||
| Eq ScriptPubKey Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types | |||||
| Ord ScriptPubKey Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Methods compare :: ScriptPubKey -> ScriptPubKey -> Ordering # (<) :: ScriptPubKey -> ScriptPubKey -> Bool # (<=) :: ScriptPubKey -> ScriptPubKey -> Bool # (>) :: ScriptPubKey -> ScriptPubKey -> Bool # (>=) :: ScriptPubKey -> ScriptPubKey -> Bool # max :: ScriptPubKey -> ScriptPubKey -> ScriptPubKey # min :: ScriptPubKey -> ScriptPubKey -> ScriptPubKey # | |||||
| type Rep ScriptPubKey Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types type Rep ScriptPubKey = D1 ('MetaData "ScriptPubKey" "Lightning.Protocol.BOLT2.Types" "ppad-bolt2-0.0.1-GZp2eCd2tiE8fNOn3OFks8" 'True) (C1 ('MetaCons "ScriptPubKey" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
scriptPubKey :: ByteString -> ScriptPubKey Source #
Construct a ScriptPubKey from a ByteString.
Accepts any length; validation of script structure is left to higher layers.
unScriptPubKey :: ScriptPubKey -> ByteString Source #
Extract the underlying ByteString from a ScriptPubKey.
Chain types
A 32-byte chain hash.
Identifies the blockchain (typically the genesis block hash).
Used in open_channel to specify which chain the channel will reside on.
Instances
| NFData ChainHash Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types | |||||
| Generic ChainHash Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Associated Types
| |||||
| Show ChainHash Source # | |||||
| Eq ChainHash Source # | |||||
| Ord ChainHash Source # | |||||
| type Rep ChainHash Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types type Rep ChainHash = D1 ('MetaData "ChainHash" "Lightning.Protocol.BOLT2.Types" "ppad-bolt2-0.0.1-GZp2eCd2tiE8fNOn3OFks8" 'True) (C1 ('MetaCons "ChainHash" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
chainHash :: ByteString -> Maybe ChainHash Source #
Construct a ChainHash from a 32-byte ByteString.
Returns Nothing if the input is not exactly 32 bytes.
unChainHash :: ChainHash -> ByteString Source #
Extract the underlying ByteString from a ChainHash.
data ShortChannelId Source #
A short channel identifier (8 bytes).
Encodes the block height (3 bytes), transaction index (3 bytes), and output index (2 bytes) of the funding transaction output.
This is a compact representation for referencing channels in gossip and routing.
Constructors
| ShortChannelId | |
Instances
| NFData ShortChannelId Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Methods rnf :: ShortChannelId -> () # | |||||
| Generic ShortChannelId Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Associated Types
Methods from :: ShortChannelId -> Rep ShortChannelId x # to :: Rep ShortChannelId x -> ShortChannelId # | |||||
| Show ShortChannelId Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Methods showsPrec :: Int -> ShortChannelId -> ShowS # show :: ShortChannelId -> String # showList :: [ShortChannelId] -> ShowS # | |||||
| Eq ShortChannelId Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Methods (==) :: ShortChannelId -> ShortChannelId -> Bool # (/=) :: ShortChannelId -> ShortChannelId -> Bool # | |||||
| Ord ShortChannelId Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Methods compare :: ShortChannelId -> ShortChannelId -> Ordering # (<) :: ShortChannelId -> ShortChannelId -> Bool # (<=) :: ShortChannelId -> ShortChannelId -> Bool # (>) :: ShortChannelId -> ShortChannelId -> Bool # (>=) :: ShortChannelId -> ShortChannelId -> Bool # max :: ShortChannelId -> ShortChannelId -> ShortChannelId # min :: ShortChannelId -> ShortChannelId -> ShortChannelId # | |||||
| type Rep ShortChannelId Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types type Rep ShortChannelId = D1 ('MetaData "ShortChannelId" "Lightning.Protocol.BOLT2.Types" "ppad-bolt2-0.0.1-GZp2eCd2tiE8fNOn3OFks8" 'False) (C1 ('MetaCons "ShortChannelId" 'PrefixI 'True) (S1 ('MetaSel ('Just "scidBytes") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word64))) | |||||
Arguments
| :: Word32 | Block height (24 bits max) |
| -> Word32 | Transaction index (24 bits max) |
| -> Word16 | Output index |
| -> Maybe ShortChannelId |
Construct a ShortChannelId from block height, tx index, and
output index.
Returns Nothing if any component exceeds its maximum value:
- block height: max 16,777,215 (2^24 - 1)
- tx index: max 16,777,215 (2^24 - 1)
- output index: max 65,535 (2^16 - 1)
>>>shortChannelId 800000 1234 0Just (ShortChannelId ...)
scidBlockHeight :: ShortChannelId -> Word32 Source #
Extract the block height from a ShortChannelId.
scidTxIndex :: ShortChannelId -> Word32 Source #
Extract the transaction index from a ShortChannelId.
scidOutputIndex :: ShortChannelId -> Word16 Source #
Extract the output index from a ShortChannelId.
Protocol types
data FeatureBits Source #
Feature bits (variable length).
Encodes supported/required features. Even bits indicate required features; odd bits indicate optional features.
Instances
| NFData FeatureBits Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Methods rnf :: FeatureBits -> () # | |||||
| Generic FeatureBits Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Associated Types
| |||||
| Show FeatureBits Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Methods showsPrec :: Int -> FeatureBits -> ShowS # show :: FeatureBits -> String # showList :: [FeatureBits] -> ShowS # | |||||
| Eq FeatureBits Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types | |||||
| Ord FeatureBits Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Methods compare :: FeatureBits -> FeatureBits -> Ordering # (<) :: FeatureBits -> FeatureBits -> Bool # (<=) :: FeatureBits -> FeatureBits -> Bool # (>) :: FeatureBits -> FeatureBits -> Bool # (>=) :: FeatureBits -> FeatureBits -> Bool # max :: FeatureBits -> FeatureBits -> FeatureBits # min :: FeatureBits -> FeatureBits -> FeatureBits # | |||||
| type Rep FeatureBits Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types type Rep FeatureBits = D1 ('MetaData "FeatureBits" "Lightning.Protocol.BOLT2.Types" "ppad-bolt2-0.0.1-GZp2eCd2tiE8fNOn3OFks8" 'True) (C1 ('MetaCons "FeatureBits" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
featureBits :: ByteString -> FeatureBits Source #
Construct FeatureBits from a ByteString.
Accepts any length; feature bit parsing is left to higher layers.
unFeatureBits :: FeatureBits -> ByteString Source #
Extract the underlying ByteString from FeatureBits.
data OnionPacket Source #
A 1366-byte onion routing packet.
Contains encrypted routing information for HTLC forwarding, as specified in BOLT #4.
Instances
| NFData OnionPacket Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Methods rnf :: OnionPacket -> () # | |||||
| Generic OnionPacket Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Associated Types
| |||||
| Show OnionPacket Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Methods showsPrec :: Int -> OnionPacket -> ShowS # show :: OnionPacket -> String # showList :: [OnionPacket] -> ShowS # | |||||
| Eq OnionPacket Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types | |||||
| Ord OnionPacket Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types Methods compare :: OnionPacket -> OnionPacket -> Ordering # (<) :: OnionPacket -> OnionPacket -> Bool # (<=) :: OnionPacket -> OnionPacket -> Bool # (>) :: OnionPacket -> OnionPacket -> Bool # (>=) :: OnionPacket -> OnionPacket -> Bool # max :: OnionPacket -> OnionPacket -> OnionPacket # min :: OnionPacket -> OnionPacket -> OnionPacket # | |||||
| type Rep OnionPacket Source # | |||||
Defined in Lightning.Protocol.BOLT2.Types type Rep OnionPacket = D1 ('MetaData "OnionPacket" "Lightning.Protocol.BOLT2.Types" "ppad-bolt2-0.0.1-GZp2eCd2tiE8fNOn3OFks8" 'True) (C1 ('MetaCons "OnionPacket" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
onionPacket :: ByteString -> Maybe OnionPacket Source #
Construct an OnionPacket from a 1366-byte ByteString.
Returns Nothing if the input is not exactly 1366 bytes.
unOnionPacket :: OnionPacket -> ByteString Source #
Extract the underlying ByteString from an OnionPacket.
Constants
channelIdLen :: Int Source #
Length of a channel_id in bytes (32).
signatureLen :: Int Source #
Length of a signature in bytes (64, compact format).
chainHashLen :: Int Source #
Length of a chain hash in bytes (32).
shortChannelIdLen :: Int Source #
Length of a short_channel_id in bytes (8).
paymentHashLen :: Int Source #
Length of a payment hash in bytes (32).
paymentPreimageLen :: Int Source #
Length of a payment preimage in bytes (32).
onionPacketLen :: Int Source #
Length of an onion routing packet in bytes (1366).