bolt2

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

commit 67521b1799241d5023ae7263f0f370d34cef02f4
parent 5dbe46093eabc21f2e1a3033dea9af13db8f04f4
Author: Jared Tobin <jared@jtobin.io>
Date:   Sun, 25 Jan 2026 15:00:25 +0400

Add INLINABLE pragmas to hot-path codec functions

Mark encode/decode functions for UpdateAddHtlc and CommitmentSigned
as INLINABLE to allow cross-module specialization at call sites.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Diffstat:
Mlib/Lightning/Protocol/BOLT2/Codec.hs | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/lib/Lightning/Protocol/BOLT2/Codec.hs b/lib/Lightning/Protocol/BOLT2/Codec.hs @@ -1123,6 +1123,7 @@ encodeUpdateAddHtlc !m = mconcat , unOnionPacket (updateAddHtlcOnionPacket m) , encodeTlvStream (updateAddHtlcTlvs m) ] +{-# INLINABLE encodeUpdateAddHtlc #-} -- | Decode an UpdateAddHtlc message (type 128). decodeUpdateAddHtlc @@ -1147,6 +1148,7 @@ decodeUpdateAddHtlc !bs = do , updateAddHtlcTlvs = tlvs } Right (msg, rest7) +{-# INLINABLE decodeUpdateAddHtlc #-} -- | Encode an UpdateFulfillHtlc message (type 130). encodeUpdateFulfillHtlc :: UpdateFulfillHtlc -> BS.ByteString @@ -1238,6 +1240,7 @@ encodeCommitmentSigned !m = do , unSignature (commitmentSignedSignature m) , encodeU16 numHtlcs ] ++ map unSignature sigs +{-# INLINABLE encodeCommitmentSigned #-} -- | Decode a CommitmentSigned message (type 132). decodeCommitmentSigned @@ -1264,6 +1267,7 @@ decodeCommitmentSigned !bs = do go !count !remaining !acc = do (s, rest) <- decodeSignatureBytes remaining go (count - 1) rest (s : acc) +{-# INLINABLE decodeCommitmentSigned #-} -- | Encode a RevokeAndAck message (type 133). encodeRevokeAndAck :: RevokeAndAck -> BS.ByteString