bolt4

Onion routing protocol, per BOLT #4 (docs.ppad.tech/bolt4).
git clone git://git.ppad.tech/bolt4.git
Log | Files | Refs | README | LICENSE

BOLT4.hs (2092B)


      1 {-# OPTIONS_HADDOCK prune #-}
      2 {-# LANGUAGE PatternSynonyms #-}
      3 
      4 -- |
      5 -- Module: Lightning.Protocol.BOLT4
      6 -- Copyright: (c) 2025 Jared Tobin
      7 -- License: MIT
      8 -- Maintainer: Jared Tobin <jared@ppad.tech>
      9 --
     10 -- BOLT4 onion routing for the Lightning Network.
     11 --
     12 -- This module re-exports the public interface from submodules.
     13 
     14 module Lightning.Protocol.BOLT4 (
     15     -- * Re-exports
     16     module Lightning.Protocol.BOLT4.Blinding
     17   , module Lightning.Protocol.BOLT4.Codec
     18   , module Lightning.Protocol.BOLT4.Prim
     19 
     20     -- * Fixed-size newtypes
     21   , Hmac32
     22   , hmac32
     23   , unHmac32
     24   , HopPayloads
     25   , hopPayloads
     26   , unHopPayloads
     27   , PaymentSecret
     28   , paymentSecret
     29   , unPaymentSecret
     30 
     31     -- * Packet types
     32   , OnionPacket(..)
     33   , HopPayload(..)
     34   , ShortChannelId(..)
     35   , shortChannelId
     36   , scidBlockHeight
     37   , scidTxIndex
     38   , scidOutputIndex
     39   , scidWord64
     40   , PaymentData(..)
     41   , TlvRecord(..)
     42 
     43     -- * Error types
     44   , FailureMessage(..)
     45   , FailureCode(..)
     46     -- ** Flag bits
     47   , pattern BADONION
     48   , pattern PERM
     49   , pattern NODE
     50   , pattern UPDATE
     51     -- ** Common failure codes
     52   , pattern InvalidRealm
     53   , pattern TemporaryNodeFailure
     54   , pattern PermanentNodeFailure
     55   , pattern RequiredNodeFeatureMissing
     56   , pattern InvalidOnionVersion
     57   , pattern InvalidOnionHmac
     58   , pattern InvalidOnionKey
     59   , pattern TemporaryChannelFailure
     60   , pattern PermanentChannelFailure
     61   , pattern AmountBelowMinimum
     62   , pattern FeeInsufficient
     63   , pattern IncorrectCltvExpiry
     64   , pattern ExpiryTooSoon
     65   , pattern IncorrectOrUnknownPaymentDetails
     66   , pattern FinalIncorrectCltvExpiry
     67   , pattern FinalIncorrectHtlcAmount
     68   , pattern ChannelDisabled
     69   , pattern ExpiryTooFar
     70   , pattern InvalidOnionPayload
     71   , pattern MppTimeout
     72 
     73     -- * Processing results
     74   , ProcessResult(..)
     75   , ForwardInfo(..)
     76   , ReceiveInfo(..)
     77 
     78     -- * Constants
     79   , onionPacketSize
     80   , hopPayloadsSize
     81   , hmacSize
     82   , pubkeySize
     83   , versionByte
     84   , maxPayloadSize
     85   ) where
     86 
     87 import Lightning.Protocol.BOLT4.Blinding
     88 import Lightning.Protocol.BOLT4.Codec
     89 import Lightning.Protocol.BOLT4.Prim
     90 import Lightning.Protocol.BOLT4.Types