| 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
- newtype ChannelId = ChannelId ByteString
- channelId :: ByteString -> Maybe ChannelId
- unChannelId :: ChannelId -> ByteString
- newtype Satoshi = Satoshi {}
- newtype MilliSatoshi = MilliSatoshi {}
- satToMsat :: Satoshi -> MilliSatoshi
- msatToSat :: MilliSatoshi -> Satoshi
- newtype Signature = Signature ByteString
- signature :: ByteString -> Maybe Signature
- unSignature :: Signature -> ByteString
- newtype Point = Point ByteString
- point :: ByteString -> Maybe Point
- unPoint :: Point -> ByteString
- newtype PaymentHash = PaymentHash ByteString
- paymentHash :: ByteString -> Maybe PaymentHash
- unPaymentHash :: PaymentHash -> ByteString
- newtype PaymentPreimage = PaymentPreimage ByteString
- paymentPreimage :: ByteString -> Maybe PaymentPreimage
- unPaymentPreimage :: PaymentPreimage -> ByteString
- newtype PerCommitmentSecret = PerCommitmentSecret ByteString
- perCommitmentSecret :: ByteString -> Maybe PerCommitmentSecret
- unPerCommitmentSecret :: PerCommitmentSecret -> ByteString
- newtype ChainHash = ChainHash ByteString
- chainHash :: ByteString -> Maybe ChainHash
- unChainHash :: ChainHash -> ByteString
- newtype ShortChannelId = ShortChannelId Word64
- shortChannelId :: Word32 -> Word32 -> Word16 -> Maybe ShortChannelId
- scidBlockHeight :: ShortChannelId -> Word32
- scidTxIndex :: ShortChannelId -> Word32
- scidOutputIndex :: ShortChannelId -> Word16
- newtype TxId = TxId ByteString
- mkTxId :: ByteString -> Maybe TxId
- data OutPoint = OutPoint {}
- data ScriptPubKey
- scriptPubKey :: ByteString -> ScriptPubKey
- unScriptPubKey :: ScriptPubKey -> ByteString
- data FeatureBits
- featureBits :: ByteString -> FeatureBits
- unFeatureBits :: FeatureBits -> ByteString
- data OnionPacket
- onionPacket :: ByteString -> Maybe OnionPacket
- unOnionPacket :: OnionPacket -> ByteString
- channelIdLen :: Int
- signatureLen :: Int
- pointLen :: Int
- chainHashLen :: Int
- shortChannelIdLen :: Int
- paymentHashLen :: Int
- paymentPreimageLen :: Int
- onionPacketLen :: Int
- perCommitmentSecretLen :: Int
Identifiers (re-exported from BOLT1)
A 32-byte channel identifier.
Constructors
| ChannelId ByteString |
Instances
| NFData ChannelId | |||||
Defined in Lightning.Protocol.BOLT1.Prim | |||||
| Generic ChannelId | |||||
Defined in Lightning.Protocol.BOLT1.Prim Associated Types
| |||||
| Show ChannelId | |||||
| Eq ChannelId | |||||
| Ord ChannelId | |||||
| type Rep ChannelId | |||||
Defined in Lightning.Protocol.BOLT1.Prim type Rep ChannelId = D1 ('MetaData "ChannelId" "Lightning.Protocol.BOLT1.Prim" "ppad-bolt1-0.0.1-GZKMoPKBmjXD9cKQTWAWgW" '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.
unChannelId :: ChannelId -> ByteString Source #
Extract the raw bytes from a ChannelId.
Amounts (re-exported from BOLT1)
Amount in satoshis.
Instances
| NFData Satoshi | |||||
Defined in Lightning.Protocol.BOLT1.Prim | |||||
| Enum Satoshi | |||||
| Generic Satoshi | |||||
Defined in Lightning.Protocol.BOLT1.Prim Associated Types
| |||||
| Num Satoshi | |||||
| Integral Satoshi | |||||
Defined in Lightning.Protocol.BOLT1.Prim | |||||
| Real Satoshi | |||||
Defined in Lightning.Protocol.BOLT1.Prim Methods toRational :: Satoshi -> Rational # | |||||
| Show Satoshi | |||||
| Eq Satoshi | |||||
| Ord Satoshi | |||||
Defined in Lightning.Protocol.BOLT1.Prim | |||||
| type Rep Satoshi | |||||
Defined in Lightning.Protocol.BOLT1.Prim | |||||
newtype MilliSatoshi Source #
Amount in millisatoshis.
Constructors
| MilliSatoshi | |
Fields | |
Instances
satToMsat :: Satoshi -> MilliSatoshi Source #
Convert Satoshi to MilliSatoshi.
msatToSat :: MilliSatoshi -> Satoshi Source #
Convert MilliSatoshi to Satoshi (rounds down).
Cryptographic types (re-exported from BOLT1)
A 64-byte compact ECDSA signature.
Constructors
| Signature ByteString |
Instances
| NFData Signature | |||||
Defined in Lightning.Protocol.BOLT1.Prim | |||||
| Generic Signature | |||||
Defined in Lightning.Protocol.BOLT1.Prim Associated Types
| |||||
| Show Signature | |||||
| Eq Signature | |||||
| Ord Signature | |||||
| type Rep Signature | |||||
Defined in Lightning.Protocol.BOLT1.Prim type Rep Signature = D1 ('MetaData "Signature" "Lightning.Protocol.BOLT1.Prim" "ppad-bolt1-0.0.1-GZKMoPKBmjXD9cKQTWAWgW" '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 raw bytes from a Signature.
A 33-byte compressed secp256k1 public key.
Constructors
| Point ByteString |
Instances
| NFData Point | |||||
Defined in Lightning.Protocol.BOLT1.Prim | |||||
| Generic Point | |||||
Defined in Lightning.Protocol.BOLT1.Prim Associated Types
| |||||
| Show Point | |||||
| Eq Point | |||||
| Ord Point | |||||
| type Rep Point | |||||
Defined in Lightning.Protocol.BOLT1.Prim type Rep Point = D1 ('MetaData "Point" "Lightning.Protocol.BOLT1.Prim" "ppad-bolt1-0.0.1-GZKMoPKBmjXD9cKQTWAWgW" '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.
newtype PaymentHash Source #
A 32-byte SHA256 payment hash.
Constructors
| PaymentHash ByteString |
Instances
| NFData PaymentHash | |||||
Defined in Lightning.Protocol.BOLT1.Prim Methods rnf :: PaymentHash -> () # | |||||
| Generic PaymentHash | |||||
Defined in Lightning.Protocol.BOLT1.Prim Associated Types
| |||||
| Show PaymentHash | |||||
Defined in Lightning.Protocol.BOLT1.Prim Methods showsPrec :: Int -> PaymentHash -> ShowS # show :: PaymentHash -> String # showList :: [PaymentHash] -> ShowS # | |||||
| Eq PaymentHash | |||||
Defined in Lightning.Protocol.BOLT1.Prim | |||||
| Ord PaymentHash | |||||
Defined in Lightning.Protocol.BOLT1.Prim 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 | |||||
Defined in Lightning.Protocol.BOLT1.Prim type Rep PaymentHash = D1 ('MetaData "PaymentHash" "Lightning.Protocol.BOLT1.Prim" "ppad-bolt1-0.0.1-GZKMoPKBmjXD9cKQTWAWgW" '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 raw bytes from a PaymentHash.
newtype PaymentPreimage Source #
A 32-byte payment preimage.
Constructors
| PaymentPreimage ByteString |
Instances
| NFData PaymentPreimage | |||||
Defined in Lightning.Protocol.BOLT1.Prim Methods rnf :: PaymentPreimage -> () # | |||||
| Generic PaymentPreimage | |||||
Defined in Lightning.Protocol.BOLT1.Prim Associated Types
Methods from :: PaymentPreimage -> Rep PaymentPreimage x # to :: Rep PaymentPreimage x -> PaymentPreimage # | |||||
| Show PaymentPreimage | |||||
Defined in Lightning.Protocol.BOLT1.Prim Methods showsPrec :: Int -> PaymentPreimage -> ShowS # show :: PaymentPreimage -> String # showList :: [PaymentPreimage] -> ShowS # | |||||
| Eq PaymentPreimage | |||||
Defined in Lightning.Protocol.BOLT1.Prim Methods (==) :: PaymentPreimage -> PaymentPreimage -> Bool # (/=) :: PaymentPreimage -> PaymentPreimage -> Bool # | |||||
| Ord PaymentPreimage | |||||
Defined in Lightning.Protocol.BOLT1.Prim 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 | |||||
Defined in Lightning.Protocol.BOLT1.Prim type Rep PaymentPreimage = D1 ('MetaData "PaymentPreimage" "Lightning.Protocol.BOLT1.Prim" "ppad-bolt1-0.0.1-GZKMoPKBmjXD9cKQTWAWgW" '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 raw bytes from a PaymentPreimage.
newtype PerCommitmentSecret Source #
A 32-byte per-commitment secret.
Constructors
| PerCommitmentSecret ByteString |
Instances
| NFData PerCommitmentSecret | |||||
Defined in Lightning.Protocol.BOLT1.Prim Methods rnf :: PerCommitmentSecret -> () # | |||||
| Generic PerCommitmentSecret | |||||
Defined in Lightning.Protocol.BOLT1.Prim Associated Types
Methods from :: PerCommitmentSecret -> Rep PerCommitmentSecret x # to :: Rep PerCommitmentSecret x -> PerCommitmentSecret # | |||||
| Show PerCommitmentSecret | |||||
Defined in Lightning.Protocol.BOLT1.Prim Methods showsPrec :: Int -> PerCommitmentSecret -> ShowS # show :: PerCommitmentSecret -> String # showList :: [PerCommitmentSecret] -> ShowS # | |||||
| Eq PerCommitmentSecret | |||||
Defined in Lightning.Protocol.BOLT1.Prim Methods (==) :: PerCommitmentSecret -> PerCommitmentSecret -> Bool # (/=) :: PerCommitmentSecret -> PerCommitmentSecret -> Bool # | |||||
| Ord PerCommitmentSecret | |||||
Defined in Lightning.Protocol.BOLT1.Prim Methods compare :: PerCommitmentSecret -> PerCommitmentSecret -> Ordering # (<) :: PerCommitmentSecret -> PerCommitmentSecret -> Bool # (<=) :: PerCommitmentSecret -> PerCommitmentSecret -> Bool # (>) :: PerCommitmentSecret -> PerCommitmentSecret -> Bool # (>=) :: PerCommitmentSecret -> PerCommitmentSecret -> Bool # max :: PerCommitmentSecret -> PerCommitmentSecret -> PerCommitmentSecret # min :: PerCommitmentSecret -> PerCommitmentSecret -> PerCommitmentSecret # | |||||
| type Rep PerCommitmentSecret | |||||
Defined in Lightning.Protocol.BOLT1.Prim type Rep PerCommitmentSecret = D1 ('MetaData "PerCommitmentSecret" "Lightning.Protocol.BOLT1.Prim" "ppad-bolt1-0.0.1-GZKMoPKBmjXD9cKQTWAWgW" 'True) (C1 ('MetaCons "PerCommitmentSecret" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
perCommitmentSecret :: ByteString -> Maybe PerCommitmentSecret Source #
Construct a PerCommitmentSecret from a 32-byte
ByteString.
Returns Nothing if the input is not exactly 32 bytes.
unPerCommitmentSecret :: PerCommitmentSecret -> ByteString Source #
Extract the raw bytes from a PerCommitmentSecret.
Chain types (re-exported from BOLT1)
A chain hash (32-byte hash identifying a blockchain).
Constructors
| ChainHash ByteString |
Instances
| NFData ChainHash | |||||
Defined in Lightning.Protocol.BOLT1.Prim | |||||
| Generic ChainHash | |||||
Defined in Lightning.Protocol.BOLT1.Prim Associated Types
| |||||
| Show ChainHash | |||||
| Eq ChainHash | |||||
| Ord ChainHash | |||||
| type Rep ChainHash | |||||
Defined in Lightning.Protocol.BOLT1.Prim type Rep ChainHash = D1 ('MetaData "ChainHash" "Lightning.Protocol.BOLT1.Prim" "ppad-bolt1-0.0.1-GZKMoPKBmjXD9cKQTWAWgW" 'True) (C1 ('MetaCons "ChainHash" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
chainHash :: ByteString -> Maybe ChainHash Source #
Construct a chain hash from a 32-byte bytestring.
Returns Nothing if the input is not exactly 32 bytes.
unChainHash :: ChainHash -> ByteString Source #
Extract the raw bytes from a chain hash.
newtype ShortChannelId Source #
A short channel identifier (8 bytes packed as Word64).
Encodes block height (3 bytes), transaction index (3 bytes), and output index (2 bytes).
Constructors
| ShortChannelId Word64 |
Instances
| NFData ShortChannelId | |||||
Defined in Lightning.Protocol.BOLT1.Prim Methods rnf :: ShortChannelId -> () # | |||||
| Generic ShortChannelId | |||||
Defined in Lightning.Protocol.BOLT1.Prim Associated Types
Methods from :: ShortChannelId -> Rep ShortChannelId x # to :: Rep ShortChannelId x -> ShortChannelId # | |||||
| Show ShortChannelId | |||||
Defined in Lightning.Protocol.BOLT1.Prim Methods showsPrec :: Int -> ShortChannelId -> ShowS # show :: ShortChannelId -> String # showList :: [ShortChannelId] -> ShowS # | |||||
| Eq ShortChannelId | |||||
Defined in Lightning.Protocol.BOLT1.Prim Methods (==) :: ShortChannelId -> ShortChannelId -> Bool # (/=) :: ShortChannelId -> ShortChannelId -> Bool # | |||||
| Ord ShortChannelId | |||||
Defined in Lightning.Protocol.BOLT1.Prim 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 | |||||
Defined in Lightning.Protocol.BOLT1.Prim type Rep ShortChannelId = D1 ('MetaData "ShortChannelId" "Lightning.Protocol.BOLT1.Prim" "ppad-bolt1-0.0.1-GZKMoPKBmjXD9cKQTWAWgW" 'True) (C1 ('MetaCons "ShortChannelId" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64))) | |||||
Arguments
| :: Word32 | Block height (24 bits max) |
| -> Word32 | Transaction index (24 bits max) |
| -> Word16 | Output index |
| -> Maybe ShortChannelId |
Construct a ShortChannelId from components.
Returns Nothing if block height or tx index exceed 24 bits.
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.
Transaction types
Transaction ID (32 bytes, little-endian double-SHA256).
Constructors
| TxId ByteString |
Instances
| NFData TxId | |||||
Defined in Bitcoin.Prim.Tx | |||||
| Generic TxId | |||||
Defined in Bitcoin.Prim.Tx Associated Types
| |||||
| Show TxId | |||||
| Eq TxId | |||||
| type Rep TxId | |||||
Defined in Bitcoin.Prim.Tx type Rep TxId = D1 ('MetaData "TxId" "Bitcoin.Prim.Tx" "ppad-tx-0.1.0-IT48EoatyO26YFokfriqJ" 'True) (C1 ('MetaCons "TxId" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
mkTxId :: ByteString -> Maybe TxId Source #
Construct a TxId from a 32-byte ByteString.
Returns Nothing if the input is not exactly 32 bytes.
mkTxId (BS.replicate 32 0x00) == Just (TxId ...) mkTxId (BS.replicate 31 0x00) == Nothing
Transaction outpoint (txid + output index).
Instances
| NFData OutPoint | |||||
Defined in Bitcoin.Prim.Tx | |||||
| Generic OutPoint | |||||
Defined in Bitcoin.Prim.Tx Associated Types
| |||||
| Show OutPoint | |||||
| Eq OutPoint | |||||
| type Rep OutPoint | |||||
Defined in Bitcoin.Prim.Tx type Rep OutPoint = D1 ('MetaData "OutPoint" "Bitcoin.Prim.Tx" "ppad-tx-0.1.0-IT48EoatyO26YFokfriqJ" 'False) (C1 ('MetaCons "OutPoint" 'PrefixI 'True) (S1 ('MetaSel ('Just "op_txid") 'SourceUnpack 'SourceStrict 'DecidedUnpack) (Rec0 TxId) :*: S1 ('MetaSel ('Just "op_vout") 'SourceUnpack 'SourceStrict 'DecidedUnpack) (Rec0 Word32))) | |||||
data ScriptPubKey Source #
A script pubkey (output script).
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-GI0K1t7dKAW7RblYmOAXen" '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.
unScriptPubKey :: ScriptPubKey -> ByteString Source #
Extract the underlying ByteString from a ScriptPubKey.
Protocol types
data FeatureBits Source #
Feature bits (variable length).
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-GI0K1t7dKAW7RblYmOAXen" '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.
unFeatureBits :: FeatureBits -> ByteString Source #
Extract the underlying ByteString from FeatureBits.
data OnionPacket Source #
A 1366-byte onion routing packet.
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-GI0K1t7dKAW7RblYmOAXen" '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).
perCommitmentSecretLen :: Int Source #
Length of a per-commitment secret in bytes (32).