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

+16 -1
View File
@@ -1920,7 +1920,7 @@ func (l *channelLink) handleUpstreamMsg(msg lnwire.Message) {
// As we've just accepted a new state, we'll now
// immediately send the remote peer a revocation for our prior
// state.
nextRevocation, currentHtlcs, _, err :=
nextRevocation, currentHtlcs, finalHTLCs, err :=
l.channel.RevokeCurrentCommitment()
if err != nil {
l.log.Errorf("unable to revoke commitment: %v", err)
@@ -1928,6 +1928,21 @@ func (l *channelLink) handleUpstreamMsg(msg lnwire.Message) {
}
l.cfg.Peer.SendMessage(false, nextRevocation)
// Notify the incoming htlcs of which the resolutions were
// locked in.
for id, settled := range finalHTLCs {
l.cfg.HtlcNotifier.NotifyFinalHtlcEvent(
channeldb.CircuitKey{
ChanID: l.shortChanID,
HtlcID: id,
},
channeldb.FinalHtlcInfo{
Settled: settled,
Offchain: true,
},
)
}
// Since we just revoked our commitment, we may have a new set
// of HTLC's on our commitment, so we'll send them using our
// function closure NotifyContractUpdate.