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:
parent
f71cc951fd
commit
93089aaaf8
@ -475,7 +475,6 @@ var chanStatusStrings = map[ChannelStatus]string{
|
|||||||
|
|
||||||
// orderedChanStatusFlags is an in-order list of all that channel status flags.
|
// orderedChanStatusFlags is an in-order list of all that channel status flags.
|
||||||
var orderedChanStatusFlags = []ChannelStatus{
|
var orderedChanStatusFlags = []ChannelStatus{
|
||||||
ChanStatusDefault,
|
|
||||||
ChanStatusBorked,
|
ChanStatusBorked,
|
||||||
ChanStatusCommitBroadcasted,
|
ChanStatusCommitBroadcasted,
|
||||||
ChanStatusLocalDataLoss,
|
ChanStatusLocalDataLoss,
|
||||||
@ -488,7 +487,7 @@ var orderedChanStatusFlags = []ChannelStatus{
|
|||||||
// String returns a human-readable representation of the ChannelStatus.
|
// String returns a human-readable representation of the ChannelStatus.
|
||||||
func (c ChannelStatus) String() string {
|
func (c ChannelStatus) String() string {
|
||||||
// If no flags are set, then this is the default case.
|
// If no flags are set, then this is the default case.
|
||||||
if c == 0 {
|
if c == ChanStatusDefault {
|
||||||
return chanStatusStrings[ChanStatusDefault]
|
return chanStatusStrings[ChanStatusDefault]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user