Internal.hs (1367B)
1 {-# OPTIONS_HADDOCK hide #-} 2 3 -- | 4 -- Module: Lightning.Protocol.BOLT3.Internal 5 -- Copyright: (c) 2025 Jared Tobin 6 -- License: MIT 7 -- Maintainer: Jared Tobin <jared@ppad.tech> 8 -- 9 -- Internal definitions for BOLT #3. 10 -- 11 -- This module exports unsafe constructors that bypass 12 -- validation. Use only in tests or trusted internal code. 13 14 module Lightning.Protocol.BOLT3.Internal ( 15 -- * Unsafe constructors (bypass validation) 16 unsafePubkey 17 , unsafeSeckey 18 , unsafeCommitmentNumber 19 , unsafeSequence 20 , unsafeLocktime 21 ) where 22 23 import qualified Data.ByteString as BS 24 import Data.Word (Word32, Word64) 25 import Lightning.Protocol.BOLT3.Types 26 27 -- | Construct a 'Pubkey' without length validation. 28 -- 29 -- For test use only. 30 unsafePubkey :: BS.ByteString -> Pubkey 31 unsafePubkey = Pubkey 32 33 -- | Construct a 'Seckey' without length validation. 34 -- 35 -- For test use only. 36 unsafeSeckey :: BS.ByteString -> Seckey 37 unsafeSeckey = Seckey 38 39 -- | Construct a 'CommitmentNumber' without range 40 -- validation. 41 -- 42 -- For test use only. 43 unsafeCommitmentNumber :: Word64 -> CommitmentNumber 44 unsafeCommitmentNumber = CommitmentNumber 45 46 -- | Construct a 'Sequence' directly. 47 -- 48 -- For test use only. 49 unsafeSequence :: Word32 -> Sequence 50 unsafeSequence = Sequence 51 52 -- | Construct a 'Locktime' directly. 53 -- 54 -- For test use only. 55 unsafeLocktime :: Word32 -> Locktime 56 unsafeLocktime = Locktime