Decode.hs (640B)
1 {-# OPTIONS_HADDOCK prune #-} 2 3 -- | 4 -- Module: Lightning.Protocol.BOLT3.Decode 5 -- Copyright: (c) 2025 Jared Tobin 6 -- License: MIT 7 -- Maintainer: Jared Tobin <jared@ppad.tech> 8 -- 9 -- Parsing for BOLT #3 transactions. 10 -- 11 -- Delegates to ppad-tx for transaction decoding. 12 13 module Lightning.Protocol.BOLT3.Decode ( 14 decode_tx 15 ) where 16 17 import qualified Bitcoin.Prim.Tx as BT 18 import qualified Data.ByteString as BS 19 20 -- | Decode a raw Bitcoin transaction from bytes. 21 -- 22 -- Handles both legacy and SegWit transaction formats. 23 -- 24 -- >>> decode_tx rawTxBytes 25 -- Just (Tx {...}) 26 decode_tx :: BS.ByteString -> Maybe BT.Tx 27 decode_tx = BT.from_bytes