From 22fddd626bead7655ebabecf79f99124ad79c603 Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Mon, 15 Sep 2025 17:02:20 +0800 Subject: [PATCH] lntest+rpcserver: ignore `chanfitness.ErrPeerNotFound` in rpc Similar to how we handle `chanfitness.ErrChannelNotFound`, we now also ignore the `ErrPeerNotFound`. This is needed as previously we will always see the peer in the channel event store given it'd added when connected. This is no longer the case as we only add the peer to the map when the channel is added. --- rpcserver.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/rpcserver.go b/rpcserver.go index 96dee318b..6fb050711 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -5080,14 +5080,19 @@ func createRPCOpenChannel(ctx context.Context, r *rpcServer, // being notified of it. outpoint := dbChannel.FundingOutpoint info, err := r.server.chanEventStore.GetChanInfo(outpoint, peer) - switch err { + switch { + // If the store does not know about the peer, we just log it. + case errors.Is(err, chanfitness.ErrPeerNotFound): + rpcsLog.Warnf("peer: %v not found by channel event store", + peer) + // If the store does not know about the channel, we just log it. - case chanfitness.ErrChannelNotFound: - rpcsLog.Infof("channel: %v not found by channel event store", + case errors.Is(err, chanfitness.ErrChannelNotFound): + rpcsLog.Warnf("channel: %v not found by channel event store", outpoint) // If we got our channel info, we further populate the channel. - case nil: + case err == nil: channel.Uptime = int64(info.Uptime.Seconds()) channel.Lifetime = int64(info.Lifetime.Seconds())