bolt2

Lightning peer protocol, per BOLT #2 (docs.ppad.tech/bolt2).
git clone git://git.ppad.tech/bolt2.git
Log | Files | Refs | README | LICENSE

BOLT2.hs (2868B)


      1 {-# OPTIONS_HADDOCK prune #-}
      2 
      3 -- |
      4 -- Module: Lightning.Protocol.BOLT2
      5 -- Copyright: (c) 2025 Jared Tobin
      6 -- License: MIT
      7 -- Maintainer: Jared Tobin <jared@ppad.tech>
      8 --
      9 -- Peer protocol for the Lightning Network, per
     10 -- [BOLT #2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md).
     11 
     12 module Lightning.Protocol.BOLT2 (
     13   -- * Core types
     14   -- | Re-exported from "Lightning.Protocol.BOLT2.Types".
     15     module Lightning.Protocol.BOLT2.Types
     16 
     17   -- * Message types
     18   -- | Re-exported from "Lightning.Protocol.BOLT2.Messages".
     19   , module Lightning.Protocol.BOLT2.Messages
     20 
     21   -- * Codec functions
     22   -- | Re-exported from "Lightning.Protocol.BOLT2.Codec".
     23   , module Lightning.Protocol.BOLT2.Codec
     24 
     25   -- $messagetypes
     26 
     27   -- ** Channel establishment (v1)
     28   -- $v1establishment
     29 
     30   -- ** Channel establishment (v2)
     31   -- $v2establishment
     32 
     33   -- ** Channel close
     34   -- $close
     35 
     36   -- ** Normal operation
     37   -- $normal
     38 
     39   -- ** Message reestablishment
     40   -- $reestablish
     41   ) where
     42 
     43 import Lightning.Protocol.BOLT2.Codec
     44 import Lightning.Protocol.BOLT2.Messages
     45 import Lightning.Protocol.BOLT2.Types
     46 
     47 -- $messagetypes
     48 --
     49 -- BOLT #2 defines the following message types:
     50 --
     51 -- * 2: stfu
     52 -- * 32: open_channel
     53 -- * 33: accept_channel
     54 -- * 34: funding_created
     55 -- * 35: funding_signed
     56 -- * 36: channel_ready
     57 -- * 38: shutdown
     58 -- * 39: closing_signed
     59 -- * 40: closing_complete
     60 -- * 41: closing_sig
     61 -- * 64: open_channel2
     62 -- * 65: accept_channel2
     63 -- * 66: tx_add_input
     64 -- * 67: tx_add_output
     65 -- * 68: tx_remove_input
     66 -- * 69: tx_remove_output
     67 -- * 70: tx_complete
     68 -- * 71: tx_signatures
     69 -- * 72: tx_init_rbf
     70 -- * 73: tx_ack_rbf
     71 -- * 74: tx_abort
     72 -- * 128: update_add_htlc
     73 -- * 130: update_fulfill_htlc
     74 -- * 131: update_fail_htlc
     75 -- * 132: commitment_signed
     76 -- * 133: revoke_and_ack
     77 -- * 134: update_fee
     78 -- * 135: update_fail_malformed_htlc
     79 -- * 136: channel_reestablish
     80 
     81 -- $v1establishment
     82 --
     83 -- Channel establishment v1 messages:
     84 --
     85 -- * open_channel (32)
     86 -- * accept_channel (33)
     87 -- * funding_created (34)
     88 -- * funding_signed (35)
     89 -- * channel_ready (36)
     90 
     91 -- $v2establishment
     92 --
     93 -- Channel establishment v2 (interactive-tx) messages:
     94 --
     95 -- * open_channel2 (64)
     96 -- * accept_channel2 (65)
     97 -- * tx_add_input (66)
     98 -- * tx_add_output (67)
     99 -- * tx_remove_input (68)
    100 -- * tx_remove_output (69)
    101 -- * tx_complete (70)
    102 -- * tx_signatures (71)
    103 -- * tx_init_rbf (72)
    104 -- * tx_ack_rbf (73)
    105 -- * tx_abort (74)
    106 
    107 -- $close
    108 --
    109 -- Channel close messages:
    110 --
    111 -- * stfu (2)
    112 -- * shutdown (38)
    113 -- * closing_signed (39)
    114 -- * closing_complete (40)
    115 -- * closing_sig (41)
    116 
    117 -- $normal
    118 --
    119 -- Normal operation messages:
    120 --
    121 -- * update_add_htlc (128)
    122 -- * update_fulfill_htlc (130)
    123 -- * update_fail_htlc (131)
    124 -- * commitment_signed (132)
    125 -- * revoke_and_ack (133)
    126 -- * update_fee (134)
    127 -- * update_fail_malformed_htlc (135)
    128 
    129 -- $reestablish
    130 --
    131 -- Message reestablishment:
    132 --
    133 -- * channel_reestablish (136)