bolt2

Lightning peer protocol, per BOLT #2 (docs.ppad.tech/bolt2).
git clone git://git.ppad.tech/bolt2.git
Log | Files | Refs | README | LICENSE

Weight.hs (2242B)


      1 module Main where
      2 
      3 import Fixtures
      4 import Lightning.Protocol.BOLT2
      5 import Weigh
      6 
      7 main :: IO ()
      8 main = case fixtures of
      9   Nothing -> fail "invalid fixtures"
     10   Just fx -> mainWith $ do
     11     func "baseline (weigh overhead)" (+ (1 :: Int)) 1
     12     wgroup "open_channel" $ do
     13       func "encode" encode_open_channel (fx_open_channel fx)
     14       func "decode" decode_open_channel (fx_open_channel_bytes fx)
     15     wgroup "accept_channel2" $ do
     16       func "encode" encode_accept_channel2 (fx_accept_channel2 fx)
     17       func "decode" decode_accept_channel2 (fx_accept_channel2_bytes fx)
     18     wgroup "tx_signatures" $ do
     19       func "encode" encode_tx_signatures (fx_tx_signatures fx)
     20       func "decode" decode_tx_signatures (fx_tx_signatures_bytes fx)
     21     wgroup "closing_complete" $ do
     22       func "encode" encode_closing_complete (fx_closing_complete fx)
     23       func "decode" decode_closing_complete (fx_closing_complete_bytes fx)
     24     wgroup "update_add_htlc" $ do
     25       func "encode" encode_update_add_htlc (fx_update_add_htlc fx)
     26       func "decode" decode_update_add_htlc (fx_update_add_htlc_bytes fx)
     27       func "encode_message" encode_message
     28         (MsgUpdateAddHtlc (fx_update_add_htlc fx))
     29       func "decode_message" decode_message (fx_update_add_htlc_wire fx)
     30     wgroup "update_fulfill_htlc" $ do
     31       func "encode" encode_update_fulfill_htlc (fx_update_fulfill_htlc fx)
     32       func "decode" decode_update_fulfill_htlc
     33         (fx_update_fulfill_htlc_bytes fx)
     34     wgroup "commitment_signed" $ do
     35       func "encode (0 htlcs)" encode_commitment_signed
     36         (fx_commitment_signed fx)
     37       func "decode (0 htlcs)" decode_commitment_signed
     38         (fx_commitment_signed_bytes fx)
     39       func "encode (483 htlcs)" encode_commitment_signed
     40         (fx_commitment_signed_483 fx)
     41       func "decode (483 htlcs)" decode_commitment_signed
     42         (fx_commitment_signed_483_bytes fx)
     43     wgroup "revoke_and_ack" $ do
     44       func "encode" encode_revoke_and_ack (fx_revoke_and_ack fx)
     45       func "decode" decode_revoke_and_ack (fx_revoke_and_ack_bytes fx)
     46     wgroup "channel_reestablish" $ do
     47       func "encode" encode_channel_reestablish (fx_channel_reestablish fx)
     48       func "decode" decode_channel_reestablish
     49         (fx_channel_reestablish_bytes fx)