| Copyright | (c) 2025 Jared Tobin |
|---|---|
| License | MIT |
| Maintainer | Jared Tobin <jared@ppad.tech> |
| Safe Haskell | None |
| Language | Haskell2010 |
Lightning.Protocol.BOLT4.Construct
Contents
Description
Onion packet construction for BOLT4.
Synopsis
- data Hop = Hop {
- hopPubKey :: !Projective
- hopPayload :: !HopPayload
- data Error
- construct :: ByteString -> [Hop] -> ByteString -> Either Error (OnionPacket, [SharedSecret])
Types
Route information for a single hop.
Constructors
| Hop | |
Fields
| |
Errors during packet construction.
Constructors
| InvalidSessionKey | |
| EmptyRoute | |
| TooManyHops | |
| PayloadTooLarge !Int | |
| InvalidHopPubKey !Int |
Packet construction
Arguments
| :: ByteString | 32-byte session key (random) |
| -> [Hop] | route (first hop to final destination) |
| -> ByteString | associated data |
| -> Either Error (OnionPacket, [SharedSecret]) |
Construct an onion packet for a payment route.
Takes a session key (32 bytes random), list of hops, and associated data (typically payment_hash).
Returns the onion packet and list of shared secrets (for error attribution).