peer.go: replace switch statements with if statements
This commit is contained in:
parent
0dda9e06ce
commit
328094d8fb
11
peer.go
11
peer.go
@ -449,11 +449,10 @@ func (p *peer) Start() error {
|
|||||||
// initGossipSync initializes either a gossip syncer or an initial routing
|
// initGossipSync initializes either a gossip syncer or an initial routing
|
||||||
// dump, depending on the negotiated synchronization method.
|
// dump, depending on the negotiated synchronization method.
|
||||||
func (p *peer) initGossipSync() {
|
func (p *peer) initGossipSync() {
|
||||||
switch {
|
|
||||||
|
|
||||||
// If the remote peer knows of the new gossip queries feature, then
|
// If the remote peer knows of the new gossip queries feature, then
|
||||||
// we'll create a new gossipSyncer in the AuthenticatedGossiper for it.
|
// we'll create a new gossipSyncer in the AuthenticatedGossiper for it.
|
||||||
case p.remoteFeatures.HasFeature(lnwire.GossipQueriesOptional):
|
if p.remoteFeatures.HasFeature(lnwire.GossipQueriesOptional) {
|
||||||
srvrLog.Infof("Negotiated chan series queries with %x",
|
srvrLog.Infof("Negotiated chan series queries with %x",
|
||||||
p.pubKeyBytes[:])
|
p.pubKeyBytes[:])
|
||||||
|
|
||||||
@ -509,9 +508,8 @@ func (p *peer) loadActiveChannels(chans []*channeldb.OpenChannel) (
|
|||||||
|
|
||||||
// Skip adding any permanently irreconcilable channels to the
|
// Skip adding any permanently irreconcilable channels to the
|
||||||
// htlcswitch.
|
// htlcswitch.
|
||||||
switch {
|
if !dbChan.HasChanStatus(channeldb.ChanStatusDefault) &&
|
||||||
case !dbChan.HasChanStatus(channeldb.ChanStatusDefault) &&
|
!dbChan.HasChanStatus(channeldb.ChanStatusRestored) {
|
||||||
!dbChan.HasChanStatus(channeldb.ChanStatusRestored):
|
|
||||||
|
|
||||||
peerLog.Warnf("ChannelPoint(%v) has status %v, won't "+
|
peerLog.Warnf("ChannelPoint(%v) has status %v, won't "+
|
||||||
"start.", chanPoint, dbChan.ChanStatus())
|
"start.", chanPoint, dbChan.ChanStatus())
|
||||||
@ -2670,8 +2668,7 @@ func (p *peer) handleInitMsg(msg *lnwire.Init) error {
|
|||||||
|
|
||||||
// Now that we know we understand their requirements, we'll check to
|
// Now that we know we understand their requirements, we'll check to
|
||||||
// see if they don't support anything that we deem to be mandatory.
|
// see if they don't support anything that we deem to be mandatory.
|
||||||
switch {
|
if !p.remoteFeatures.HasFeature(lnwire.DataLossProtectRequired) {
|
||||||
case !p.remoteFeatures.HasFeature(lnwire.DataLossProtectRequired):
|
|
||||||
return fmt.Errorf("data loss protection required")
|
return fmt.Errorf("data loss protection required")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user