@@ -70,9 +70,23 @@ module ClosingHelpers =
7070 }
7171
7272 type HtlcTransaction =
73- | Success of htlcId : HTLCId * spk : Script * preimage : PaymentPreimage
74- | Timeout of htlcId : HTLCId * spk : Script * blockHeight : uint32
75- | Penalty of redeemScript : Script
73+ | Success of
74+ htlcId: HTLCId *
75+ spk: Script *
76+ preimage: PaymentPreimage *
77+ amount: LNMoney
78+ | Timeout of
79+ htlcId: HTLCId *
80+ spk: Script *
81+ blockHeight: uint32 *
82+ amount: LNMoney
83+ | Penalty of redeemScript : Script * amount : LNMoney
84+
85+ member this.Amount =
86+ match this with
87+ | Success(_, _, _, amount)
88+ | Timeout(_, _, _, amount)
89+ | Penalty(_, amount) -> amount
7690
7791 let tryGetObscuredCommitmentNumber
7892 ( fundingOutPoint : OutPoint )
@@ -294,7 +308,8 @@ module ClosingHelpers =
294308 HtlcTransaction.Success(
295309 htlcAddMsg.HTLCId,
296310 spk,
297- preimage
311+ preimage,
312+ htlcAddMsg.Amount
298313 )
299314 )
300315 else
@@ -326,7 +341,8 @@ module ClosingHelpers =
326341 HtlcTransaction.Timeout(
327342 htlcAddMsg.HTLCId,
328343 spk,
329- htlcAddMsg.CLTVExpiry.Value
344+ htlcAddMsg.CLTVExpiry.Value,
345+ htlcAddMsg.Amount
330346 )
331347 )
332348 else
@@ -364,7 +380,7 @@ module ClosingHelpers =
364380 localChannelPrivKeys.HtlcBasepointSecret
365381
366382 match htlcInfo with
367- | Timeout( htlcId, _, _) ->
383+ | Timeout( htlcId, _, _, _ ) ->
368384 let htlcAddMsg =
369385 remoteCommit.Spec.IncomingHTLCs |> Map.find htlcId
370386
@@ -406,7 +422,7 @@ module ClosingHelpers =
406422 |> ignore< TransactionBuilder>
407423
408424 txb, false
409- | Success( htlcId, _, preImage) ->
425+ | Success( htlcId, _, preImage, _ ) ->
410426 let htlcAddMsg =
411427 remoteCommit.Spec.OutgoingHTLCs |> Map.find htlcId
412428
@@ -652,7 +668,8 @@ module ClosingHelpers =
652668 HtlcTransaction.Timeout(
653669 htlcAddMsg.HTLCId,
654670 spk,
655- htlcAddMsg.CLTVExpiry.Value
671+ htlcAddMsg.CLTVExpiry.Value,
672+ htlcAddMsg.Amount
656673 )
657674 )
658675 else
@@ -687,7 +704,8 @@ module ClosingHelpers =
687704 HtlcTransaction.Success(
688705 htlcAddMsg.HTLCId,
689706 spk,
690- preimage
707+ preimage,
708+ htlcAddMsg.Amount
691709 )
692710 )
693711 else
@@ -732,7 +750,7 @@ module ClosingHelpers =
732750 localCommitmentPubKeys.DelayedPaymentPubKey
733751
734752 match htlcInfo with
735- | Timeout( htlcId, _, _) ->
753+ | Timeout( htlcId, _, _, _ ) ->
736754 let htlcAddMsg =
737755 localCommit.Spec.OutgoingHTLCs |> Map.find htlcId
738756
@@ -782,7 +800,7 @@ module ClosingHelpers =
782800 |> ignore< TransactionBuilder>
783801
784802 txb, true
785- | Success( htlcId, _, preImage) ->
803+ | Success( htlcId, _, preImage, _ ) ->
786804 let htlcAddMsg =
787805 localCommit.Spec.IncomingHTLCs |> Map.find htlcId
788806
@@ -1223,7 +1241,12 @@ module ClosingHelpers =
12231241 )
12241242
12251243 if outputExistsInCommitmentTx then
1226- Some( HtlcTransaction.Penalty redeem)
1244+ Some(
1245+ HtlcTransaction.Penalty(
1246+ redeem,
1247+ htlcAddMsg.Amount
1248+ )
1249+ )
12271250 else
12281251 None
12291252 )
@@ -1250,7 +1273,12 @@ module ClosingHelpers =
12501273 )
12511274
12521275 if outputExistsInCommitmentTx then
1253- Some( HtlcTransaction.Penalty redeem)
1276+ Some(
1277+ HtlcTransaction.Penalty(
1278+ redeem,
1279+ htlcAddMsg.Amount
1280+ )
1281+ )
12541282 else
12551283 None
12561284 )
@@ -1303,7 +1331,7 @@ module ClosingHelpers =
13031331 localChannelPrivKeys.RevocationBasepointSecret
13041332
13051333 match htlcInfo with
1306- | Penalty redeemScript ->
1334+ | Penalty( redeemScript, _) ->
13071335 let spk = redeemScript.WitHash.ScriptPubKey
13081336 let txIn = findScriptPubKey closingTx spk
13091337
0 commit comments