peer: return more detailed errors from the Start() method
This commit is contained in:
parent
adce64e21c
commit
52ffb026af
10
peer.go
10
peer.go
@ -205,11 +205,11 @@ func (p *peer) Start() error {
|
|||||||
// 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.
|
||||||
if err := p.sendInitMsg(); err != nil {
|
if err := p.sendInitMsg(); err != nil {
|
||||||
return err
|
return fmt.Errorf("unable to send init msg: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Before we launch any of the helper goroutines off the peer struct,
|
// Before we launch any of the helper goroutines off the peer struct,
|
||||||
// we'll first ensure proper adherence to the p2p protocl. The init
|
// we'll first ensure proper adherence to the p2p protocol. The init
|
||||||
// message MUST be sent before any other message.
|
// message MUST be sent before any other message.
|
||||||
readErr := make(chan error, 1)
|
readErr := make(chan error, 1)
|
||||||
msgChan := make(chan lnwire.Message, 1)
|
msgChan := make(chan lnwire.Message, 1)
|
||||||
@ -231,7 +231,7 @@ func (p *peer) Start() error {
|
|||||||
"seconds")
|
"seconds")
|
||||||
case err := <-readErr:
|
case err := <-readErr:
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("unable to read init msg: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1264,7 +1264,7 @@ out:
|
|||||||
func (p *peer) handleInitMsg(msg *lnwire.Init) error {
|
func (p *peer) handleInitMsg(msg *lnwire.Init) error {
|
||||||
localSharedFeatures, err := p.server.localFeatures.Compare(msg.LocalFeatures)
|
localSharedFeatures, err := p.server.localFeatures.Compare(msg.LocalFeatures)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := errors.Errorf("can compare remote and local feature "+
|
err := errors.Errorf("can't compare remote and local feature "+
|
||||||
"vectors: %v", err)
|
"vectors: %v", err)
|
||||||
peerLog.Error(err)
|
peerLog.Error(err)
|
||||||
return err
|
return err
|
||||||
@ -1273,7 +1273,7 @@ func (p *peer) handleInitMsg(msg *lnwire.Init) error {
|
|||||||
|
|
||||||
globalSharedFeatures, err := p.server.globalFeatures.Compare(msg.GlobalFeatures)
|
globalSharedFeatures, err := p.server.globalFeatures.Compare(msg.GlobalFeatures)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := errors.Errorf("can compare remote and global feature "+
|
err := errors.Errorf("can't compare remote and global feature "+
|
||||||
"vectors: %v", err)
|
"vectors: %v", err)
|
||||||
peerLog.Error(err)
|
peerLog.Error(err)
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user