bolt7

Routing gossip protocol, per BOLT #7.
git clone git://git.ppad.tech/bolt7.git
Log | Files | Refs | README | LICENSE

commit 44a0e91dd1d55eafe0acd6b247490b5c4afd8390
parent f206f2b3870a44a6b8592edbcb681fb0902f0cca
Author: Jared Tobin <jared@jtobin.io>
Date:   Sun, 25 Jan 2026 15:38:11 +0400

Enhance Haddock documentation

- Add comprehensive module overview and usage examples to BOLT7.hs
- Add OPTIONS_HADDOCK prune to all public modules
- Document protocol overview, usage patterns, and code examples

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Diffstat:
Mlib/Lightning/Protocol/BOLT7.hs | 59+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mlib/Lightning/Protocol/BOLT7/Codec.hs | 2++
Mlib/Lightning/Protocol/BOLT7/Hash.hs | 2++
Mlib/Lightning/Protocol/BOLT7/Messages.hs | 2++
Mlib/Lightning/Protocol/BOLT7/Types.hs | 2++
Mlib/Lightning/Protocol/BOLT7/Validate.hs | 2++
6 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/lib/Lightning/Protocol/BOLT7.hs b/lib/Lightning/Protocol/BOLT7.hs @@ -8,6 +8,65 @@ -- -- Routing gossip protocol for the Lightning Network, per -- [BOLT #7](https://github.com/lightning/bolts/blob/master/07-routing-gossip.md). +-- +-- = Overview +-- +-- This module provides types, encoding\/decoding, and validation for +-- BOLT #7 routing gossip messages. The protocol enables nodes to +-- share channel and node information across the network. +-- +-- = Usage +-- +-- Import this module to access all BOLT #7 functionality: +-- +-- @ +-- import Lightning.Protocol.BOLT7 +-- @ +-- +-- == Decoding messages +-- +-- @ +-- -- Decode a channel_announcement from wire format +-- case decodeChannelAnnouncement wireBytes of +-- Left err -> handleError err +-- Right (msg, rest) -> processAnnouncement msg +-- @ +-- +-- == Encoding messages +-- +-- @ +-- -- Encode a gossip_timestamp_filter +-- let msg = GossipTimestampFilter +-- { gossipFilterChainHash = mainnetChainHash +-- , gossipFilterFirstTimestamp = 1609459200 +-- , gossipFilterTimestampRange = 86400 +-- } +-- let wireBytes = encodeGossipTimestampFilter msg +-- @ +-- +-- == Validation +-- +-- @ +-- -- Validate a channel_announcement before processing +-- case validateChannelAnnouncement announcement of +-- Left ValidateNodeIdOrdering -> rejectMessage +-- Right () -> processValidMessage +-- @ +-- +-- == Signature verification +-- +-- This library provides hash computation for signature verification: +-- +-- @ +-- -- Compute the hash that should be signed +-- let sigHash = channelAnnouncementHash encodedMessage +-- -- Verify signatures using ppad-secp256k1 (not included) +-- @ +-- +-- = Protocol overview +-- +-- BOLT #7 defines gossip messages for routing in the Lightning Network. +-- Nodes use these messages to build a view of the channel graph. module Lightning.Protocol.BOLT7 ( -- * Core types diff --git a/lib/Lightning/Protocol/BOLT7/Codec.hs b/lib/Lightning/Protocol/BOLT7/Codec.hs @@ -1,3 +1,5 @@ +{-# OPTIONS_HADDOCK prune #-} + {-# LANGUAGE BangPatterns #-} {-# LANGUAGE DeriveGeneric #-} diff --git a/lib/Lightning/Protocol/BOLT7/Hash.hs b/lib/Lightning/Protocol/BOLT7/Hash.hs @@ -1,3 +1,5 @@ +{-# OPTIONS_HADDOCK prune #-} + {-# LANGUAGE BangPatterns #-} -- | diff --git a/lib/Lightning/Protocol/BOLT7/Messages.hs b/lib/Lightning/Protocol/BOLT7/Messages.hs @@ -1,3 +1,5 @@ +{-# OPTIONS_HADDOCK prune #-} + {-# LANGUAGE BangPatterns #-} {-# LANGUAGE DeriveGeneric #-} diff --git a/lib/Lightning/Protocol/BOLT7/Types.hs b/lib/Lightning/Protocol/BOLT7/Types.hs @@ -1,3 +1,5 @@ +{-# OPTIONS_HADDOCK prune #-} + {-# LANGUAGE BangPatterns #-} {-# LANGUAGE DeriveGeneric #-} diff --git a/lib/Lightning/Protocol/BOLT7/Validate.hs b/lib/Lightning/Protocol/BOLT7/Validate.hs @@ -1,3 +1,5 @@ +{-# OPTIONS_HADDOCK prune #-} + {-# LANGUAGE BangPatterns #-} {-# LANGUAGE DeriveGeneric #-}