htlcswitch: notify outgoing link failures for local sends
Notify link failures for our own payments. Separate handling code is required for local payment link failures because we do not pass these failures back through the switch (like we do for link failures for forwards), but rather send them straight back to the router. Our own sends have the payment ID saved in the incoming htlc ID of the packet's incoming circuit. This change replaces that value with for the sake of consistent notifying of sends and receives from our node.
This commit is contained in:
parent
937062b6d3
commit
79a890fa48
@ -770,6 +770,20 @@ func (s *Switch) handleLocalDispatch(pkt *htlcPacket) error {
|
|||||||
if htlc, ok := pkt.htlc.(*lnwire.UpdateAddHTLC); ok {
|
if htlc, ok := pkt.htlc.(*lnwire.UpdateAddHTLC); ok {
|
||||||
link, err := s.handleLocalAddHTLC(pkt, htlc)
|
link, err := s.handleLocalAddHTLC(pkt, htlc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
// Notify the htlc notifier of a link failure on our
|
||||||
|
// outgoing link. Incoming timelock/amount values are
|
||||||
|
// not set because they are not present for local sends.
|
||||||
|
s.cfg.HtlcNotifier.NotifyLinkFailEvent(
|
||||||
|
newHtlcKey(pkt),
|
||||||
|
HtlcInfo{
|
||||||
|
OutgoingTimeLock: htlc.Expiry,
|
||||||
|
OutgoingAmt: htlc.Amount,
|
||||||
|
},
|
||||||
|
HtlcEventTypeSend,
|
||||||
|
err,
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user