Skip to content

Commit e29f818

Browse files
committed
Fix broken HTLC handling in Spec.Reduce function
1 parent bd27a14 commit e29f818

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/DotNetLightning.Core/Transactions/CommitmentSpec.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@ type CommitmentSpec = {
4141
{ this with ToRemote = this.ToRemote - update.Amount; IncomingHTLCs = this.IncomingHTLCs.Add(update.HTLCId, update)}
4242

4343
member internal this.FulfillOutgoingHTLC(htlcId: HTLCId) =
44-
match this.OutgoingHTLCs |> Map.tryFind htlcId with
44+
match this.IncomingHTLCs |> Map.tryFind htlcId with
4545
| Some htlc ->
46-
{ this with ToLocal = this.ToLocal + htlc.Amount; OutgoingHTLCs = this.OutgoingHTLCs.Remove htlcId }
46+
{ this with ToLocal = this.ToLocal + htlc.Amount; IncomingHTLCs = this.IncomingHTLCs.Remove htlcId }
4747
|> Ok
4848
| None ->
4949
UnknownHTLC htlcId |> Error
5050

5151
member internal this.FulfillIncomingHTLC(htlcId: HTLCId) =
52-
match this.IncomingHTLCs |> Map.tryFind htlcId with
52+
match this.OutgoingHTLCs |> Map.tryFind htlcId with
5353
| Some htlc ->
54-
{ this with ToRemote = this.ToRemote + htlc.Amount; IncomingHTLCs = this.IncomingHTLCs.Remove htlcId }
54+
{ this with ToRemote = this.ToRemote + htlc.Amount; OutgoingHTLCs = this.OutgoingHTLCs.Remove htlcId }
5555
|> Ok
5656
| None ->
5757
UnknownHTLC htlcId |> Error

0 commit comments

Comments
 (0)