htlcswitch: log the error returned from SendMessage
This commit is contained in:
1 file changed
+21
-5
+21
-5
@@ -1018,7 +1018,11 @@ func (l *channelLink) syncChanStates(ctx context.Context) error {
|
|||||||
// immediately so we return to a synchronized state as soon as
|
// immediately so we return to a synchronized state as soon as
|
||||||
// possible.
|
// possible.
|
||||||
for _, msg := range msgsToReSend {
|
for _, msg := range msgsToReSend {
|
||||||
l.cfg.Peer.SendMessage(false, msg)
|
err := l.cfg.Peer.SendMessage(false, msg)
|
||||||
|
if err != nil {
|
||||||
|
l.log.Errorf("failed to send %v: %v",
|
||||||
|
msg.MsgType(), err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case <-l.cg.Done():
|
case <-l.cg.Done():
|
||||||
@@ -1619,7 +1623,10 @@ func (l *channelLink) handleDownstreamUpdateAdd(ctx context.Context,
|
|||||||
l.openedCircuits = append(l.openedCircuits, pkt.inKey())
|
l.openedCircuits = append(l.openedCircuits, pkt.inKey())
|
||||||
l.keystoneBatch = append(l.keystoneBatch, pkt.keystone())
|
l.keystoneBatch = append(l.keystoneBatch, pkt.keystone())
|
||||||
|
|
||||||
_ = l.cfg.Peer.SendMessage(false, htlc)
|
err = l.cfg.Peer.SendMessage(false, htlc)
|
||||||
|
if err != nil {
|
||||||
|
l.log.Errorf("failed to send UpdateAddHTLC: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
// Send a forward event notification to htlcNotifier.
|
// Send a forward event notification to htlcNotifier.
|
||||||
l.cfg.HtlcNotifier.NotifyForwardingEvent(
|
l.cfg.HtlcNotifier.NotifyForwardingEvent(
|
||||||
@@ -2021,7 +2028,10 @@ func (l *channelLink) updateCommitTx(ctx context.Context) error {
|
|||||||
PartialSig: newCommit.PartialSig,
|
PartialSig: newCommit.PartialSig,
|
||||||
CustomRecords: auxBlobRecords,
|
CustomRecords: auxBlobRecords,
|
||||||
}
|
}
|
||||||
l.cfg.Peer.SendMessage(false, commitSig)
|
err = l.cfg.Peer.SendMessage(false, commitSig)
|
||||||
|
if err != nil {
|
||||||
|
l.log.Errorf("failed to send CommitSig: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
// Now that we have sent out a new CommitSig, we invoke the outgoing set
|
// Now that we have sent out a new CommitSig, we invoke the outgoing set
|
||||||
// of commit hooks.
|
// of commit hooks.
|
||||||
@@ -3485,11 +3495,14 @@ func (l *channelLink) settleHTLC(preimage lntypes.Preimage,
|
|||||||
|
|
||||||
// HTLC was successfully settled locally send notification about it
|
// HTLC was successfully settled locally send notification about it
|
||||||
// remote peer.
|
// remote peer.
|
||||||
l.cfg.Peer.SendMessage(false, &lnwire.UpdateFulfillHTLC{
|
err = l.cfg.Peer.SendMessage(false, &lnwire.UpdateFulfillHTLC{
|
||||||
ChanID: l.ChanID(),
|
ChanID: l.ChanID(),
|
||||||
ID: htlcIndex,
|
ID: htlcIndex,
|
||||||
PaymentPreimage: preimage,
|
PaymentPreimage: preimage,
|
||||||
})
|
})
|
||||||
|
if err != nil {
|
||||||
|
l.log.Errorf("failed to send UpdateFulfillHTLC: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
// Once we have successfully settled the htlc, notify a settle event.
|
// Once we have successfully settled the htlc, notify a settle event.
|
||||||
l.cfg.HtlcNotifier.NotifySettleEvent(
|
l.cfg.HtlcNotifier.NotifySettleEvent(
|
||||||
@@ -3684,12 +3697,15 @@ func (l *channelLink) sendMalformedHTLCError(htlcIndex uint64,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l.cfg.Peer.SendMessage(false, &lnwire.UpdateFailMalformedHTLC{
|
err = l.cfg.Peer.SendMessage(false, &lnwire.UpdateFailMalformedHTLC{
|
||||||
ChanID: l.ChanID(),
|
ChanID: l.ChanID(),
|
||||||
ID: htlcIndex,
|
ID: htlcIndex,
|
||||||
ShaOnionBlob: shaOnionBlob,
|
ShaOnionBlob: shaOnionBlob,
|
||||||
FailureCode: code,
|
FailureCode: code,
|
||||||
})
|
})
|
||||||
|
if err != nil {
|
||||||
|
l.log.Errorf("failed to send UpdateFailMalformedHTLC: %v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// failf is a function which is used to encapsulate the action necessary for
|
// failf is a function which is used to encapsulate the action necessary for
|
||||||
|
|||||||
Reference in new issue
Block a user