mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-07 11:15:00 +02:00
peer: log disconnect to info, remove go-errors pkg
This commit is contained in:
19
peer.go
19
peer.go
@@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"container/list"
|
"container/list"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"sync"
|
"sync"
|
||||||
@@ -15,7 +16,6 @@ import (
|
|||||||
"github.com/btcsuite/btcd/txscript"
|
"github.com/btcsuite/btcd/txscript"
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
"github.com/davecgh/go-spew/spew"
|
"github.com/davecgh/go-spew/spew"
|
||||||
"github.com/go-errors/errors"
|
|
||||||
"github.com/lightningnetwork/lnd/brontide"
|
"github.com/lightningnetwork/lnd/brontide"
|
||||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
@@ -32,7 +32,7 @@ var (
|
|||||||
numNodes int32
|
numNodes int32
|
||||||
|
|
||||||
// ErrPeerExiting signals that the peer received a disconnect request.
|
// ErrPeerExiting signals that the peer received a disconnect request.
|
||||||
ErrPeerExiting = errors.Errorf("peer exiting")
|
ErrPeerExiting = fmt.Errorf("peer exiting")
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -113,7 +113,7 @@ type peer struct {
|
|||||||
pubKeyBytes [33]byte
|
pubKeyBytes [33]byte
|
||||||
|
|
||||||
// startTime is the time this peer connection was successfully
|
// startTime is the time this peer connection was successfully
|
||||||
// established. It will be zero for peers that did not successfuly
|
// established. It will be zero for peers that did not successfully
|
||||||
// Start().
|
// Start().
|
||||||
startTime time.Time
|
startTime time.Time
|
||||||
|
|
||||||
@@ -239,7 +239,7 @@ func (p *peer) Start() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
peerLog.Tracef("peer %v starting", p)
|
peerLog.Tracef("Peer %v starting", p)
|
||||||
|
|
||||||
// Exchange local and global features, the init message should be very
|
// Exchange local and global features, the init message should be very
|
||||||
// first between two nodes.
|
// first between two nodes.
|
||||||
@@ -606,7 +606,7 @@ func (p *peer) Disconnect(reason error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
peerLog.Debugf("Disconnecting %s, reason: %v", p, reason)
|
peerLog.Infof("Disconnecting %s, reason: %v", p, reason)
|
||||||
|
|
||||||
// Ensure that the TCP connection is properly closed before continuing.
|
// Ensure that the TCP connection is properly closed before continuing.
|
||||||
p.conn.Close()
|
p.conn.Close()
|
||||||
@@ -1361,7 +1361,8 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
exitErr = errors.Errorf("unable to write message: %v", err)
|
exitErr = fmt.Errorf("unable to write "+
|
||||||
|
"message: %v", err)
|
||||||
break out
|
break out
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2093,17 +2094,15 @@ func (p *peer) handleInitMsg(msg *lnwire.Init) error {
|
|||||||
|
|
||||||
unknownLocalFeatures := p.remoteLocalFeatures.UnknownRequiredFeatures()
|
unknownLocalFeatures := p.remoteLocalFeatures.UnknownRequiredFeatures()
|
||||||
if len(unknownLocalFeatures) > 0 {
|
if len(unknownLocalFeatures) > 0 {
|
||||||
err := errors.Errorf("Peer set unknown local feature bits: %v",
|
err := fmt.Errorf("Peer set unknown local feature bits: %v",
|
||||||
unknownLocalFeatures)
|
unknownLocalFeatures)
|
||||||
peerLog.Error(err)
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
unknownGlobalFeatures := p.remoteGlobalFeatures.UnknownRequiredFeatures()
|
unknownGlobalFeatures := p.remoteGlobalFeatures.UnknownRequiredFeatures()
|
||||||
if len(unknownGlobalFeatures) > 0 {
|
if len(unknownGlobalFeatures) > 0 {
|
||||||
err := errors.Errorf("Peer set unknown global feature bits: %v",
|
err := fmt.Errorf("Peer set unknown global feature bits: %v",
|
||||||
unknownGlobalFeatures)
|
unknownGlobalFeatures)
|
||||||
peerLog.Error(err)
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user