htlcswitch: notify send forward failures and settles

Add notifications for local initiated sends settles and forwarding
failures. As with link failures, local send settles and forwarding
failures are reported directly to the router so must have their own
notification handling.
This commit is contained in:
carla 2020-02-19 17:34:47 +02:00
parent 79a890fa48
commit 22d370aa51
No known key found for this signature in database
GPG Key ID: 4CA7FE54A6213C91

@ -898,6 +898,18 @@ func (s *Switch) handleLocalResponse(pkt *htlcPacket) {
pkt.inKey(), err)
return
}
// Finally, notify on the htlc failure or success that has been handled.
key := newHtlcKey(pkt)
eventType := getEventType(pkt)
switch pkt.htlc.(type) {
case *lnwire.UpdateFulfillHTLC:
s.cfg.HtlcNotifier.NotifySettleEvent(key, eventType)
case *lnwire.UpdateFailHTLC:
s.cfg.HtlcNotifier.NotifyForwardingFailEvent(key, eventType)
}
}
// extractResult uses the given deobfuscator to extract the payment result from