From eb2b0c783fdbf635140d1caae779bf91ca7f8fe7 Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Fri, 17 Jan 2025 00:18:47 +0800 Subject: [PATCH] graph: fix `staticcheck` suggestion From staticcheck: QF1002 - Convert untagged switch to tagged switch. --- graph/builder.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/graph/builder.go b/graph/builder.go index 0eb8b5933..1aa948800 100644 --- a/graph/builder.go +++ b/graph/builder.go @@ -1408,11 +1408,10 @@ func (b *Builder) processUpdate(msg interface{}, // check if we already have the most up-to-date information for // that edge. If this message has a timestamp not strictly // newer than what we already know of we can exit early. - switch { + switch msg.ChannelFlags & lnwire.ChanUpdateDirection { // A flag set of 0 indicates this is an announcement for the // "first" node in the channel. - case msg.ChannelFlags&lnwire.ChanUpdateDirection == 0: - + case 0: // Ignore outdated message. if !edge1Timestamp.Before(msg.LastUpdate) { return NewErrf(ErrOutdated, "Ignoring "+ @@ -1423,8 +1422,7 @@ func (b *Builder) processUpdate(msg interface{}, // Similarly, a flag set of 1 indicates this is an announcement // for the "second" node in the channel. - case msg.ChannelFlags&lnwire.ChanUpdateDirection == 1: - + case 1: // Ignore outdated message. if !edge2Timestamp.Before(msg.LastUpdate) { return NewErrf(ErrOutdated, "Ignoring "+