diff --git a/rpcserver.go b/rpcserver.go index 11227fe64..ff02ea0d3 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -3696,9 +3696,7 @@ func (r *rpcServer) sendPayment(stream *paymentStream) error { select { case <-reqQuit: return - case <-r.quit: - errChan <- nil - return + default: // Receive the next pending payment within the // stream sent by the client. If we read the @@ -3756,6 +3754,9 @@ func (r *rpcServer) sendPayment(stream *paymentStream) error { case err := <-errChan: return err + case <-r.quit: + return errors.New("rpc server shutting down") + case payIntent := <-payChan: // We launch a new goroutine to execute the current // payment so we can continue to serve requests while