From 93089aaaf8d4ad0d5c054283fea3a07891bfec55 Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Fri, 10 Apr 2020 16:10:48 -0700 Subject: [PATCH] channeldb/channel: don't print ChanStatusDefault when it's not This commit removes ChanStatusDefault from the list of orderedChanStatusFlags since it is not flag. As with the prior commit, the logic around these flags assumes everything in the list is a flag, but ChanStatusDefault is not. It turns out we properly special case that if the channel is in ChanStatusDefault that we only return ChanStatusDefault. However, if any of the bits are set we would always report ChanStatusDefault since status&0 == 0. This fixed simply by removing ChanStatusDefault from the list since we only need the list to express non-default status flags. --- channeldb/channel.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/channeldb/channel.go b/channeldb/channel.go index e2e6658d..2031b7b3 100644 --- a/channeldb/channel.go +++ b/channeldb/channel.go @@ -475,7 +475,6 @@ var chanStatusStrings = map[ChannelStatus]string{ // orderedChanStatusFlags is an in-order list of all that channel status flags. var orderedChanStatusFlags = []ChannelStatus{ - ChanStatusDefault, ChanStatusBorked, ChanStatusCommitBroadcasted, ChanStatusLocalDataLoss, @@ -488,7 +487,7 @@ var orderedChanStatusFlags = []ChannelStatus{ // String returns a human-readable representation of the ChannelStatus. func (c ChannelStatus) String() string { // If no flags are set, then this is the default case. - if c == 0 { + if c == ChanStatusDefault { return chanStatusStrings[ChanStatusDefault] }