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.
This commit is contained in:
Conner Fromknecht 2020-04-10 16:10:48 -07:00
parent f71cc951fd
commit 93089aaaf8
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7

@ -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]
}