bolt9

Lightning feature flags, per BOLT #9 (docs.ppad.tech/bolt9).
git clone git://git.ppad.tech/bolt9.git
Log | Files | Refs | README | LICENSE

Fixtures.hs (1067B)


      1 module Fixtures (
      2     typical
      3   , padded
      4   , large
      5   , maximal
      6   , zeroconf_type
      7   , zeroconf_type_features
      8   ) where
      9 
     10 import qualified Data.ByteString as BS
     11 import qualified Lightning.Protocol.BOLT9 as B9
     12 
     13 -- | An init feature vector of the sort deployed nodes send (8 bytes).
     14 typical :: B9.FeatureVector
     15 typical = foldr B9.set_bit B9.empty
     16   [1, 5, 7, 8, 11, 12, 14, 17, 23, 25, 27, 35, 39, 45, 47, 51, 61]
     17 
     18 -- | 'typical' with four leading zero bytes.
     19 padded :: B9.FeatureVector
     20 padded = B9.parse (BS.replicate 4 0 <> B9.render typical)
     21 
     22 -- | 64 bytes with every odd bit set.
     23 large :: B9.FeatureVector
     24 large = B9.parse (BS.replicate 64 0xAA)
     25 
     26 -- | A maximum-length (65535-byte) vector with every bit set.
     27 maximal :: B9.FeatureVector
     28 maximal = B9.parse (BS.replicate 65535 0xFF)
     29 
     30 -- | An anchors channel type with both variations.
     31 zeroconf_type :: B9.ChannelType
     32 zeroconf_type = B9.ChannelType B9.BasicAnchors True True
     33 
     34 -- | The vector for 'zeroconf_type'.
     35 zeroconf_type_features :: B9.FeatureVector
     36 zeroconf_type_features = B9.channel_type_features zeroconf_type