Skip to content

Commit

Permalink
rpcserver: return on EOF
Browse files Browse the repository at this point in the history
  • Loading branch information
guggero committed Nov 27, 2020
1 parent 468715c commit b830718
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"encoding/hex"
"errors"
"fmt"
"io"
"net"
"sync"
"sync/atomic"
Expand Down Expand Up @@ -35,6 +36,8 @@ import (
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/signal"
"github.com/lightningnetwork/lnd/tor"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)

const (
Expand Down Expand Up @@ -239,6 +242,14 @@ func (s *rpcServer) consumePendingOpenChannels(
}

rpcLog.Errorf("Unable to read channel event: %v", err)

// If the lnd node shut down, there's no use continuing.
if err == io.EOF || err == io.ErrUnexpectedEOF ||
status.Code(err) == codes.Unavailable {

return
}

continue
}

Expand Down

0 comments on commit b830718

Please sign in to comment.