ppad-bolt9-0.0.1: Feature flags per BOLT #9
Copyright(c) 2025 Jared Tobin
LicenseMIT
MaintainerJared Tobin <jared@ppad.tech>
Safe HaskellSafe-Inferred
LanguageHaskell2010

Lightning.Protocol.BOLT9.Features

Description

Known feature table for the Lightning Network, per BOLT #9.

Synopsis

Feature

data Feature Source #

A known feature from the BOLT #9 specification.

Constructors

Feature 

Fields

Instances

Instances details
NFData Feature Source # 
Instance details

Defined in Lightning.Protocol.BOLT9.Features

Methods

rnf :: Feature -> () #

Generic Feature Source # 
Instance details

Defined in Lightning.Protocol.BOLT9.Features

Associated Types

type Rep Feature 
Instance details

Defined in Lightning.Protocol.BOLT9.Features

type Rep Feature = D1 ('MetaData "Feature" "Lightning.Protocol.BOLT9.Features" "ppad-bolt9-0.0.1-SCTy7SY2nBJMXEGG76XgS" 'False) (C1 ('MetaCons "Feature" 'PrefixI 'True) ((S1 ('MetaSel ('Just "featureName") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 String) :*: S1 ('MetaSel ('Just "featureBaseBit") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word16)) :*: (S1 ('MetaSel ('Just "featureContexts") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [Context]) :*: (S1 ('MetaSel ('Just "featureDependencies") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [String]) :*: S1 ('MetaSel ('Just "featureAssumed") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool)))))

Methods

from :: Feature -> Rep Feature x #

to :: Rep Feature x -> Feature #

Show Feature Source # 
Instance details

Defined in Lightning.Protocol.BOLT9.Features

Eq Feature Source # 
Instance details

Defined in Lightning.Protocol.BOLT9.Features

Methods

(==) :: Feature -> Feature -> Bool #

(/=) :: Feature -> Feature -> Bool #

type Rep Feature Source # 
Instance details

Defined in Lightning.Protocol.BOLT9.Features

type Rep Feature = D1 ('MetaData "Feature" "Lightning.Protocol.BOLT9.Features" "ppad-bolt9-0.0.1-SCTy7SY2nBJMXEGG76XgS" 'False) (C1 ('MetaCons "Feature" 'PrefixI 'True) ((S1 ('MetaSel ('Just "featureName") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 String) :*: S1 ('MetaSel ('Just "featureBaseBit") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word16)) :*: (S1 ('MetaSel ('Just "featureContexts") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [Context]) :*: (S1 ('MetaSel ('Just "featureDependencies") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [String]) :*: S1 ('MetaSel ('Just "featureAssumed") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool)))))

Lookup

featureByBit :: Word16 -> Maybe Feature Source #

Look up a feature by bit number.

Accepts either the even (compulsory) or odd (optional) bit of the pair.

>>> fmap featureName (featureByBit 16)
Just "basic_mpp"
>>> fmap featureName (featureByBit 17)  -- odd bit also works
Just "basic_mpp"
>>> featureByBit 999
Nothing

featureByName :: String -> Maybe Feature Source #

Look up a feature by its canonical name.

>>> fmap featureBaseBit (featureByName "basic_mpp")
Just 16
>>> featureByName "nonexistent"
Nothing

Known features table

knownFeatures :: [Feature] Source #

The complete table of known features from BOLT #9.