bolt9

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

Main.hs (1739B)


      1 module Main where
      2 
      3 import Criterion.Main
      4 import qualified Lightning.Protocol.BOLT9 as B9
      5 import Fixtures
      6 
      7 main :: IO ()
      8 main = defaultMain [
      9     bgroup "vector" [
     10         bench "union" $ nf (B9.union typical) large
     11       , bench "set_bit" $ nf (B9.set_bit 101) typical
     12       , bench "clear_bit" $ nf (B9.clear_bit 17) typical
     13       , bench "test_bit" $ nf (B9.test_bit 17) typical
     14       , bench "set_bits" $ nf B9.set_bits typical
     15       , bench "== (leading zeros)" $ nf (== typical) padded
     16       ]
     17 
     18   , bgroup "feature" [
     19         bench "set_feature" $
     20           nf (B9.set_feature B9.OptionSplice B9.Optional) typical
     21       , bench "set_feature_with_deps" $
     22           nf (B9.set_feature_with_deps B9.OptionZeroconf B9.Optional)
     23              B9.empty
     24       , bench "test_feature" $ nf (B9.test_feature B9.BasicMpp) typical
     25       , bench "list_features" $ nf B9.list_features typical
     26       , bench "feature_by_bit" $ nf B9.feature_by_bit 51
     27       ]
     28 
     29   , bgroup "validate" [
     30         bench "validate_local (init)" $
     31           nf (B9.validate_local B9.InitContext) typical
     32       , bench "validate_remote (init)" $
     33           nf (B9.validate_remote B9.InitContext) typical
     34       , bench "validate_remote (init, 64 bytes)" $
     35           nf (B9.validate_remote B9.InitContext) large
     36       , bench "validate_remote (init, 65535 bytes)" $
     37           nf (B9.validate_remote B9.InitContext) maximal
     38       , bench "validate_remote (channel_type)" $
     39           nf (B9.validate_remote B9.ChannelTypeContext)
     40              zeroconf_type_features
     41       ]
     42 
     43   , bgroup "channel type" [
     44         bench "channel_type" $ nf B9.channel_type zeroconf_type_features
     45       , bench "channel_type_features" $
     46           nf B9.channel_type_features zeroconf_type
     47       ]
     48   ]