Weight.hs (1597B)
1 module Main where 2 3 import Fixtures 4 import Lightning.Protocol.BOLT4 5 import Weigh 6 7 main :: IO () 8 main = do 9 fx <- fixtures 10 mainWith $ do 11 wgroup "construct" $ do 12 func "1 hop" (construct (fx_session fx) (fx_route_1 fx)) (fx_ad fx) 13 func "5 hops" (construct (fx_session fx) (fx_route_5 fx)) (fx_ad fx) 14 func "20 hops" (construct (fx_session fx) (fx_route_20 fx)) (fx_ad fx) 15 wgroup "process" $ do 16 func "forward" 17 (process (fx_first_node fx) (fx_onion_5 fx) (fx_ad fx)) Nothing 18 func "receive" 19 (process (fx_first_node fx) (fx_onion_1 fx) (fx_ad fx)) Nothing 20 func "forward (blinded)" 21 (process (fx_blinded_node fx) (fx_blinded_onion fx) (fx_ad fx)) 22 (Just (fx_path_key fx)) 23 wgroup "returning errors" $ do 24 func "construct_error" (construct_error (fx_secret fx)) (fx_failure fx) 25 func "wrap_error" (wrap_error (fx_secret fx)) (fx_error fx) 26 func "unwrap_error (hop 4 of 5)" 27 (unwrap_error (fx_secrets_5 fx)) (fx_returned fx) 28 wgroup "route blinding" $ do 29 func "create_blinded_path (3 hops)" 30 (create_blinded_path (fx_path_seed fx)) (fx_path_nodes fx) 31 func "decrypt_recipient_data" 32 (decrypt_recipient_data (fx_blinded_node fx) (fx_path_key fx)) 33 (fx_encrypted fx) 34 wgroup "codecs" $ do 35 func "encode_onion_packet" encode_onion_packet (fx_onion_5 fx) 36 func "decode_onion_packet" decode_onion_packet (fx_onion_bytes fx) 37 func "encode_hop_payload" encode_hop_payload (fx_payload fx) 38 func "decode_hop_payload" decode_hop_payload (fx_payload_bytes fx)