ppad-bolt4-0.0.1: BOLT4 (onion routing) for Lightning Network
Copyright(c) 2025 Jared Tobin
LicenseMIT
MaintainerJared Tobin <jared@ppad.tech>
Safe HaskellNone
LanguageHaskell2010

Lightning.Protocol.BOLT4.Process

Description

Onion packet processing for BOLT4.

Synopsis

Processing

process Source #

Arguments

:: ByteString

32-byte secret key of this node

-> OnionPacket

incoming onion packet

-> ByteString

associated data (payment hash)

-> Either RejectReason ProcessResult 

Process an incoming onion packet.

Takes the receiving node's private key, the incoming packet, and associated data (typically the payment hash).

Returns either a rejection reason or the processing result (forward to next hop or receive at final destination).

Rejection reasons

data RejectReason Source #

Reasons for rejecting a packet.

Constructors

InvalidVersion !Word8

Version byte is not 0x00

InvalidEphemeralKey

Malformed public key

HmacMismatch

HMAC verification failed

InvalidPayload !String

Malformed hop payload

Instances

Instances details
Generic RejectReason Source # 
Instance details

Defined in Lightning.Protocol.BOLT4.Process

Associated Types

type Rep RejectReason 
Instance details

Defined in Lightning.Protocol.BOLT4.Process

type Rep RejectReason = D1 ('MetaData "RejectReason" "Lightning.Protocol.BOLT4.Process" "ppad-bolt4-0.0.1-33TgaKMcRznIG3ThlfUxBs" 'False) ((C1 ('MetaCons "InvalidVersion" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8)) :+: C1 ('MetaCons "InvalidEphemeralKey" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "HmacMismatch" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "InvalidPayload" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 String))))
Show RejectReason Source # 
Instance details

Defined in Lightning.Protocol.BOLT4.Process

Eq RejectReason Source # 
Instance details

Defined in Lightning.Protocol.BOLT4.Process

type Rep RejectReason Source # 
Instance details

Defined in Lightning.Protocol.BOLT4.Process

type Rep RejectReason = D1 ('MetaData "RejectReason" "Lightning.Protocol.BOLT4.Process" "ppad-bolt4-0.0.1-33TgaKMcRznIG3ThlfUxBs" 'False) ((C1 ('MetaCons "InvalidVersion" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8)) :+: C1 ('MetaCons "InvalidEphemeralKey" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "HmacMismatch" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "InvalidPayload" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 String))))