Merge pull request #1810 from wpaulino/switch-no-links-found
htlcswitch+server: avoid logging error if no links are found within peerTerminationWatcher
This commit is contained in:
commit
8d02d74e0f
@ -55,6 +55,10 @@ var (
|
|||||||
// request.
|
// request.
|
||||||
ErrSwitchExiting = errors.New("htlcswitch shutting down")
|
ErrSwitchExiting = errors.New("htlcswitch shutting down")
|
||||||
|
|
||||||
|
// ErrNoLinksFound is an error returned when we attempt to retrieve the
|
||||||
|
// active links in the switch for a specific destination.
|
||||||
|
ErrNoLinksFound = errors.New("no channel links found")
|
||||||
|
|
||||||
// zeroPreimage is the empty preimage which is returned when we have
|
// zeroPreimage is the empty preimage which is returned when we have
|
||||||
// some errors.
|
// some errors.
|
||||||
zeroPreimage [sha256.Size]byte
|
zeroPreimage [sha256.Size]byte
|
||||||
@ -2105,8 +2109,7 @@ func (s *Switch) GetLinksByInterface(hop [33]byte) ([]ChannelLink, error) {
|
|||||||
func (s *Switch) getLinks(destination [33]byte) ([]ChannelLink, error) {
|
func (s *Switch) getLinks(destination [33]byte) ([]ChannelLink, error) {
|
||||||
links, ok := s.interfaceIndex[destination]
|
links, ok := s.interfaceIndex[destination]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("unable to locate channel link by "+
|
return nil, ErrNoLinksFound
|
||||||
"destination hop id %x", destination)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
channelLinks := make([]ChannelLink, 0, len(links))
|
channelLinks := make([]ChannelLink, 0, len(links))
|
||||||
|
@ -2449,8 +2449,9 @@ func (s *server) peerTerminationWatcher(p *peer, ready chan struct{}) {
|
|||||||
//
|
//
|
||||||
// TODO(roasbeef): instead add a PurgeInterfaceLinks function?
|
// TODO(roasbeef): instead add a PurgeInterfaceLinks function?
|
||||||
links, err := p.server.htlcSwitch.GetLinksByInterface(p.pubKeyBytes)
|
links, err := p.server.htlcSwitch.GetLinksByInterface(p.pubKeyBytes)
|
||||||
if err != nil {
|
if err != nil && err != htlcswitch.ErrNoLinksFound {
|
||||||
srvrLog.Errorf("unable to get channel links: %v", err)
|
srvrLog.Errorf("Unable to get channel links for %x: %v",
|
||||||
|
p.pubKeyBytes, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, link := range links {
|
for _, link := range links {
|
||||||
|
Loading…
Reference in New Issue
Block a user