htlcswitch: add final htlc event to notifier

This commit is contained in:
Joost Jager committed 2022-10-27 16:42:36 +02:00
1 parent 28256b7ea8
commit 511fb00777
21 files changed
+729 -404

No files matched your search

+27
View File
@@ -3535,6 +3535,13 @@ func checkHtlcEvents(t *testing.T, events <-chan interface{},
t.Fatalf("expected event: %v", expected)
}
}
// Check that there are no unexpected events following.
select {
case event := <-events:
t.Fatalf("unexpected event: %v", event)
default:
}
}
// sendThreeHopPayment is a helper function which sends a payment over
@@ -3638,6 +3645,12 @@ func getThreeHopEvents(channels *clusterChannels, htlcID uint64,
Incoming: false,
Timestamp: ts,
},
&FinalHtlcEvent{
CircuitKey: bobKey.IncomingCircuit,
Settled: false,
Offchain: true,
Timestamp: ts,
},
}
return aliceEvents, bobEvents, nil
@@ -3669,6 +3682,12 @@ func getThreeHopEvents(channels *clusterChannels, htlcID uint64,
HtlcEventType: HtlcEventTypeForward,
Timestamp: ts,
},
&FinalHtlcEvent{
CircuitKey: bobKey.IncomingCircuit,
Settled: true,
Offchain: true,
Timestamp: ts,
},
}
carolEvents := []interface{}{
@@ -3683,6 +3702,14 @@ func getThreeHopEvents(channels *clusterChannels, htlcID uint64,
Preimage: *preimage,
HtlcEventType: HtlcEventTypeReceive,
Timestamp: ts,
}, &FinalHtlcEvent{
CircuitKey: channeldb.CircuitKey{
ChanID: channels.carolToBob.ShortChanID(),
HtlcID: htlcID,
},
Settled: true,
Offchain: true,
Timestamp: ts,
},
}