bolt3

Lightning transaction and script formats, per BOLT #3 (docs.ppad.tech/bolt3).
git clone git://git.ppad.tech/bolt3.git
Log | Files | Refs | README | LICENSE

Weight.hs (2279B)


      1 module Main where
      2 
      3 import Fixtures
      4 import Lightning.Protocol.BOLT3
      5 import Weigh
      6 
      7 main :: IO ()
      8 main = do
      9   fx <- fixtures
     10   let (next_idx, next_secret) = fx_store_next fx
     11   mainWith $ do
     12     wgroup "keys" $ do
     13       func "derive_per_commitment_point" derive_per_commitment_point
     14         (fx_secret fx)
     15       func "derive_per_commitment_point'" (derive_per_commitment_point' tex)
     16         (fx_secret fx)
     17       func "derive_pubkey" (derive_pubkey (fx_basepoint fx)) (fx_pcp fx)
     18       func "derive_revocationpubkey" (derive_revocationpubkey (fx_rbp fx))
     19         (fx_pcp fx)
     20       func "derive_commitment_keys"
     21         (derive_commitment_keys (fx_local_bps fx) (fx_local_fund fx)
     22            (fx_remote_bps fx) (fx_remote_fund fx))
     23         (fx_pcp fx)
     24       func "derive_commitment_keys'"
     25         (derive_commitment_keys' tex (fx_local_bps fx) (fx_local_fund fx)
     26            (fx_remote_bps fx) (fx_remote_fund fx))
     27         (fx_pcp fx)
     28       func "derive_privkey" (derive_privkey (fx_seckey fx)) (fx_pcp fx)
     29       func "derive_revocationprivkey"
     30         (derive_revocationprivkey (fx_seckey fx)) (fx_secret fx)
     31     wgroup "secrets" $ do
     32       func "generate_from_seed (index 2^48 - 1)"
     33         (generate_from_seed (fx_seed fx)) (fx_store_oldest fx)
     34       func "insert_secret (14 lower buckets)"
     35         (insert_secret next_secret next_idx) (fx_store fx)
     36       func "derive_old_secret (index 2^48 - 1)"
     37         (derive_old_secret (fx_store_oldest fx)) (fx_store fx)
     38       func "secret_store . un_secret_store"
     39         (secret_store . un_secret_store) (fx_store fx)
     40     wgroup "transactions" $ do
     41       func "build_commitment_tx (no htlcs)" build_commitment_tx
     42         (fx_ctx_simple fx)
     43       func "build_commitment_tx (5 htlcs)" build_commitment_tx
     44         (fx_ctx_htlcs fx)
     45       func "build_commitment_tx (5 htlcs, anchors)" build_commitment_tx
     46         (fx_ctx_anchors fx)
     47       func "encode_commitment_tx (5 htlcs)" encode_commitment_tx
     48         (fx_commit fx)
     49       func "build_htlc_tx" build_htlc_tx (fx_htlc_ctx fx)
     50       func "encode_htlc_tx" encode_htlc_tx (fx_htlc_tx fx)
     51       func "build_closing_tx" build_closing_tx (fx_closing fx)
     52       func "build_legacy_closing_tx" build_legacy_closing_tx (fx_legacy fx)
     53       func "encode_closing_tx" encode_closing_tx (fx_closing_tx fx)