bolt5

On-chain transaction handling for Lightning (docs.ppad.tech/bolt5).
git clone git://git.ppad.tech/bolt5.git
Log | Files | Refs | README | LICENSE

commit c994874e73c9b556a9a2f22f00528504d8e81720
parent a78a10eb8237f34273ae59a43093fd8c75d24277
Author: Jared Tobin <jared@jtobin.io>
Date:   Mon, 20 Apr 2026 15:34:03 +0800

bench: update NFData instances and fixtures for new types

Add NFData instances for HTLCOutputType, RevokedOutputType, and
RevokedOutput. Update mkRevokedOutputs to use RevokedOutput instead
of UnresolvedOutput.

Diffstat:
Mbench/Main.hs | 20++++++++++++++++----
Mbench/Weight.hs | 23+++++++++++++++++++----
2 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/bench/Main.hs b/bench/Main.hs @@ -66,10 +66,22 @@ instance NFData B5.OutputResolution where rnf (B5.Revoke rk) = rnf rk rnf _ = () +instance NFData B5.HTLCOutputType where + rnf (B5.HTLCOfferedOutput e) = rnf e + rnf (B5.HTLCReceivedOutput e) = rnf e + instance NFData B5.UnresolvedOutput where rnf (B5.UnresolvedOutput op v t) = rnf op `seq` rnf v `seq` rnf t +instance NFData B5.RevokedOutputType where + rnf B5.RevokedToLocal = () + rnf (B5.RevokedHTLC h) = rnf h + +instance NFData B5.RevokedOutput where + rnf (B5.RevokedOutput op v t) = + rnf op `seq` rnf v `seq` rnf t + instance NFData B5.SpendingTx where rnf (B5.SpendingTx tx scr val sh) = rnf tx `seq` rnf scr `seq` rnf val `seq` rnf sh @@ -118,13 +130,13 @@ dummyFeerate = FeeratePerKw 253 dummyDelay :: ToSelfDelay dummyDelay = ToSelfDelay 144 -mkRevokedOutputs :: Int -> NE.NonEmpty B5.UnresolvedOutput +mkRevokedOutputs :: Int -> NE.NonEmpty B5.RevokedOutput mkRevokedOutputs n = - let uo i = B5.UnresolvedOutput + let ro i = B5.RevokedOutput (OutPoint dummyTxId (fromIntegral i)) (Satoshi 10000) - (B5.Revoke dummyRevPk) - in uo 0 NE.:| [ uo i | i <- [1..n-1] ] + B5.RevokedToLocal + in ro 0 NE.:| [ ro i | i <- [1..n-1] ] -- benchmarks --------------------------------------------------------- diff --git a/bench/Weight.hs b/bench/Weight.hs @@ -43,6 +43,9 @@ instance NFData FeeratePerKw where instance NFData ToSelfDelay where rnf (ToSelfDelay x) = rnf x +instance NFData CltvExpiry where + rnf (CltvExpiry x) = rnf x + instance NFData SighashType instance NFData B5.OutputResolution where @@ -50,10 +53,22 @@ instance NFData B5.OutputResolution where rnf (B5.Revoke rk) = rnf rk rnf _ = () +instance NFData B5.HTLCOutputType where + rnf (B5.HTLCOfferedOutput e) = rnf e + rnf (B5.HTLCReceivedOutput e) = rnf e + instance NFData B5.UnresolvedOutput where rnf (B5.UnresolvedOutput op v t) = rnf op `seq` rnf v `seq` rnf t +instance NFData B5.RevokedOutputType where + rnf B5.RevokedToLocal = () + rnf (B5.RevokedHTLC h) = rnf h + +instance NFData B5.RevokedOutput where + rnf (B5.RevokedOutput op v t) = + rnf op `seq` rnf v `seq` rnf t + instance NFData B5.SpendingTx where rnf (B5.SpendingTx tx scr val sh) = rnf tx `seq` rnf scr `seq` rnf val `seq` rnf sh @@ -102,13 +117,13 @@ dummyFeerate = FeeratePerKw 253 dummyDelay :: ToSelfDelay dummyDelay = ToSelfDelay 144 -mkRevokedOutputs :: Int -> NE.NonEmpty B5.UnresolvedOutput +mkRevokedOutputs :: Int -> NE.NonEmpty B5.RevokedOutput mkRevokedOutputs n = - let uo i = B5.UnresolvedOutput + let ro i = B5.RevokedOutput (OutPoint dummyTxId (fromIntegral i)) (Satoshi 10000) - (B5.Revoke dummyRevPk) - in uo 0 NE.:| [ uo i | i <- [1..n-1] ] + B5.RevokedToLocal + in ro 0 NE.:| [ ro i | i <- [1..n-1] ] -- weights ------------------------------------------------------------