| Copyright | (c) 2025 Jared Tobin |
|---|---|
| License | MIT |
| Maintainer | Jared Tobin <jared@ppad.tech> |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Lightning.Protocol.BOLT9.Features
Description
Known feature table for the Lightning Network, per BOLT #9.
Synopsis
- data Feature = Feature {
- featureName :: !String
- featureBaseBit :: !Word16
- featureContexts :: ![Context]
- featureDependencies :: ![String]
- featureAssumed :: !Bool
- newtype KnownFeature = KnownFeature {}
- knownFeatureByBit :: Word16 -> Maybe KnownFeature
- knownFeatureByName :: String -> Maybe KnownFeature
- featureByBit :: Word16 -> Maybe Feature
- featureByName :: String -> Maybe Feature
- knownFeatures :: [Feature]
Feature
A known feature from the BOLT #9 specification.
Constructors
| Feature | |
Fields
| |
Instances
Known feature
newtype KnownFeature Source #
A feature that is known to be in the BOLT #9 specification.
Constructed via knownFeatureByBit or knownFeatureByName,
which validate that the feature exists in the known table.
Constructors
| KnownFeature | |
Fields
| |
Instances
| NFData KnownFeature Source # | |||||
Defined in Lightning.Protocol.BOLT9.Features Methods rnf :: KnownFeature -> () # | |||||
| Generic KnownFeature Source # | |||||
Defined in Lightning.Protocol.BOLT9.Features Associated Types
| |||||
| Show KnownFeature Source # | |||||
Defined in Lightning.Protocol.BOLT9.Features Methods showsPrec :: Int -> KnownFeature -> ShowS # show :: KnownFeature -> String # showList :: [KnownFeature] -> ShowS # | |||||
| Eq KnownFeature Source # | |||||
Defined in Lightning.Protocol.BOLT9.Features | |||||
| type Rep KnownFeature Source # | |||||
Defined in Lightning.Protocol.BOLT9.Features type Rep KnownFeature = D1 ('MetaData "KnownFeature" "Lightning.Protocol.BOLT9.Features" "ppad-bolt9-0.0.1-SCTy7SY2nBJMXEGG76XgS" 'True) (C1 ('MetaCons "KnownFeature" 'PrefixI 'True) (S1 ('MetaSel ('Just "unKnownFeature") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Feature))) | |||||
knownFeatureByBit :: Word16 -> Maybe KnownFeature Source #
Look up a known feature by bit number.
Accepts either the even (compulsory) or odd (optional) bit.
>>>fmap (featureName . unKnownFeature) (knownFeatureByBit 16)Just "basic_mpp">>>knownFeatureByBit 999Nothing
knownFeatureByName :: String -> Maybe KnownFeature Source #
Look up a known feature by its canonical name.
>>>fmap (featureName . unKnownFeature)... (knownFeatureByName "basic_mpp") Just "basic_mpp">>>knownFeatureByName "nonexistent"Nothing
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 worksJust "basic_mpp">>>featureByBit 999Nothing
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.