From c42bf9b54530e935de84375bd6f856beeeb5aa4e Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Wed, 2 Jul 2025 21:47:00 +0800 Subject: [PATCH] htlcswitch: log err in the end in `handleUpstreamMsg` --- htlcswitch/link.go | 59 ++++++++++++---------------------------------- 1 file changed, 15 insertions(+), 44 deletions(-) diff --git a/htlcswitch/link.go b/htlcswitch/link.go index 759095847..ac880a7f4 100644 --- a/htlcswitch/link.go +++ b/htlcswitch/link.go @@ -1916,66 +1916,32 @@ func (l *channelLink) handleUpstreamMsg(ctx context.Context, return } + var err error + switch msg := msg.(type) { case *lnwire.UpdateAddHTLC: - err := l.processRemoteUpdateAddHTLC(msg) - if err != nil { - l.log.Errorf("failed to process remote ADD: %v", err) - return - } + err = l.processRemoteUpdateAddHTLC(msg) case *lnwire.UpdateFulfillHTLC: - err := l.processRemoteUpdateFulfillHTLC(msg) - if err != nil { - l.log.Errorf("failed to process remote fulfill: %v", - err) - - return - } + err = l.processRemoteUpdateFulfillHTLC(msg) case *lnwire.UpdateFailMalformedHTLC: - err := l.processRemoteUpdateFailMalformedHTLC(msg) - if err != nil { - l.log.Errorf("failed to process remote fail "+ - "malformed: %v", err) - - return - } + err = l.processRemoteUpdateFailMalformedHTLC(msg) case *lnwire.UpdateFailHTLC: - err := l.processRemoteUpdateFailHTLC(msg) - if err != nil { - l.log.Errorf("failed to process remote fail: %v", err) - return - } + err = l.processRemoteUpdateFailHTLC(msg) case *lnwire.CommitSig: - err := l.processRemoteCommitSig(ctx, msg) - if err != nil { - l.log.Errorf("failed to process remote commit sig: %v", - err) - - return - } + err = l.processRemoteCommitSig(ctx, msg) case *lnwire.RevokeAndAck: - err := l.processRemoteRevokeAndAck(ctx, msg) - if err != nil { - l.log.Errorf("failed to process remote revoke: %v", err) - return - } + err = l.processRemoteRevokeAndAck(ctx, msg) case *lnwire.UpdateFee: - err := l.processRemoteUpdateFee(msg) - if err != nil { - l.log.Errorf("failed to process remote update fee: %v", - err) - - return - } + err = l.processRemoteUpdateFee(msg) case *lnwire.Stfu: - err := l.handleStfu(msg) + err = l.handleStfu(msg) if err != nil { l.stfuFailf("handleStfu: %v", err.Error()) } @@ -1993,6 +1959,11 @@ func (l *channelLink) handleUpstreamMsg(ctx context.Context, default: l.log.Warnf("received unknown message of type %T", msg) } + + if err != nil { + l.log.Errorf("failed to process remote %v: %v", msg.MsgType(), + err) + } } // handleStfu implements the top-level logic for handling the Stfu message from