Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ func getClientConn(config *TapdConfig) (*grpc.ClientConn, error) {
}

// Dial the gRPC server.
conn, err := grpc.Dial(config.Host, opts...)
conn, err := grpc.NewClient(config.Host, opts...)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some grpc.Dial calls still live in looprpc/client.pb.gw.go
We can bump protobuf deps and run make rpc to fix that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great catch!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated the protobuf dependency, but a single occurrence remains, due to backward-compat issues.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I managed to get rid of it here: hieblmi#4

if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/loop/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func getDebugClient(ctx context.Context, cmd *cli.Command) (looprpc.DebugClient,
if err != nil {
return nil, nil, err
}
conn, err := getClientConn(ctx, rpcServer, tlsCertPath, macaroonPath)
conn, err := getClientConn(rpcServer, tlsCertPath, macaroonPath)
if err != nil {
return nil, nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/loop/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var getInfoCommand = &cli.Command{
}

func getInfo(ctx context.Context, cmd *cli.Command) error {
client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/loop/instantout.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func instantOut(ctx context.Context, cmd *cli.Command) error {
}

// First set up the swap client itself.
client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
Expand Down Expand Up @@ -213,7 +213,7 @@ var listInstantOutsCommand = &cli.Command{

func listInstantOuts(ctx context.Context, cmd *cli.Command) error {
// First set up the swap client itself.
client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/loop/l402.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var listAuthCommand = &cli.Command{
}

func listAuth(ctx context.Context, cmd *cli.Command) error {
client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
Expand Down Expand Up @@ -85,7 +85,7 @@ var fetchL402Command = &cli.Command{
}

func fetchL402(ctx context.Context, cmd *cli.Command) error {
client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
Expand Down
12 changes: 6 additions & 6 deletions cmd/loop/liquidity.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var getLiquidityParamsCommand = &cli.Command{
}

func getParams(ctx context.Context, cmd *cli.Command) error {
client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
Expand Down Expand Up @@ -98,15 +98,15 @@ func setRule(ctx context.Context, cmd *cli.Command) error {
pubkeyRule = true
}

client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
defer cleanup()

// We need to set the full set of current parameters every time we call
// SetParameters. To allow users to set only individual fields on the
// cli, we lookup our current params, then update individual values.
// cli, we look up our current params, then update individual values.
params, err := client.GetLiquidityParams(
ctx, &looprpc.GetLiquidityParamsRequest{},
)
Expand Down Expand Up @@ -395,15 +395,15 @@ var setParamsCommand = &cli.Command{
}

func setParams(ctx context.Context, cmd *cli.Command) error {
client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
defer cleanup()

// We need to set the full set of current parameters every time we call
// SetParameters. To allow users to set only individual fields on the
// cli, we lookup our current params, then update individual values.
// cli, we look up our current params, then update individual values.
params, err := client.GetLiquidityParams(
ctx, &looprpc.GetLiquidityParamsRequest{},
)
Expand Down Expand Up @@ -693,7 +693,7 @@ var suggestSwapCommand = &cli.Command{
}

func suggestSwap(ctx context.Context, cmd *cli.Command) error {
client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/loop/loopin.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func loopIn(ctx context.Context, cmd *cli.Command) error {
return err
}

client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/loop/loopout.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func loopOut(ctx context.Context, cmd *cli.Command) error {
}
}

client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
Expand Down
18 changes: 9 additions & 9 deletions cmd/loop/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,10 @@ func main() {

// getClient establishes a SwapClient RPC connection and returns the client and
// a cleanup handler.
func getClient(ctx context.Context, cmd *cli.Command) (looprpc.SwapClientClient,
func getClient(cmd *cli.Command) (looprpc.SwapClientClient,
func(), error) {

client, _, cleanup, err := getClientWithConn(ctx, cmd)
client, _, cleanup, err := getClientWithConn(cmd)
if err != nil {
return nil, nil, err
}
Expand All @@ -205,15 +205,15 @@ func getClient(ctx context.Context, cmd *cli.Command) (looprpc.SwapClientClient,

// getClientWithConn returns both the SwapClient RPC client and the underlying
// gRPC connection so callers can perform connection-aware actions.
func getClientWithConn(ctx context.Context, cmd *cli.Command) (
looprpc.SwapClientClient, *grpc.ClientConn, func(), error) {
func getClientWithConn(cmd *cli.Command) (looprpc.SwapClientClient,
*grpc.ClientConn, func(), error) {

rpcServer := cmd.String("rpcserver")
tlsCertPath, macaroonPath, err := extractPathArgs(cmd)
if err != nil {
return nil, nil, nil, err
}
conn, err := getClientConn(ctx, rpcServer, tlsCertPath, macaroonPath)
conn, err := getClientConn(rpcServer, tlsCertPath, macaroonPath)
if err != nil {
return nil, nil, nil, err
}
Expand Down Expand Up @@ -432,7 +432,7 @@ func logSwap(swap *looprpc.SwapStatus) {
fmt.Println()
}

func getClientConn(ctx context.Context, address, tlsCertPath, macaroonPath string) (*grpc.ClientConn,
func getClientConn(address, tlsCertPath, macaroonPath string) (*grpc.ClientConn,
error) {

// We always need to send a macaroon.
Expand All @@ -446,17 +446,17 @@ func getClientConn(ctx context.Context, address, tlsCertPath, macaroonPath strin
macOption,
}

// TLS cannot be disabled, we'll always have a cert file to read.
// Since TLS cannot be disabled, we'll always have a cert file to read.
creds, err := credentials.NewClientTLSFromFile(tlsCertPath, "")
if err != nil {
return nil, err
}

opts = append(opts, grpc.WithTransportCredentials(creds))

conn, err := grpc.DialContext(ctx, address, opts...)
conn, err := grpc.NewClient(address, opts...)
if err != nil {
return nil, fmt.Errorf("unable to connect to RPC server: %v",
return nil, fmt.Errorf("unable to create RPC client: %v",
err)
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/loop/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var monitorCommand = &cli.Command{
}

func monitor(ctx context.Context, cmd *cli.Command) error {
client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/loop/quote.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func quoteIn(ctx context.Context, cmd *cli.Command) error {
}
}

client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
Expand Down Expand Up @@ -199,7 +199,7 @@ func quoteOut(ctx context.Context, cmd *cli.Command) error {
return err
}

client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/loop/reservations.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var (
)

func listReservations(ctx context.Context, cmd *cli.Command) error {
client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
Expand Down
16 changes: 8 additions & 8 deletions cmd/loop/staticaddr.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func newStaticAddress(ctx context.Context, cmd *cli.Command) error {
return err
}

client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
Expand Down Expand Up @@ -107,7 +107,7 @@ func listUnspent(ctx context.Context, cmd *cli.Command) error {
return showCommandHelp(ctx, cmd)
}

client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
Expand Down Expand Up @@ -173,7 +173,7 @@ func withdraw(ctx context.Context, cmd *cli.Command) error {
return showCommandHelp(ctx, cmd)
}

client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
Expand Down Expand Up @@ -251,7 +251,7 @@ func listDeposits(ctx context.Context, cmd *cli.Command) error {
return showCommandHelp(ctx, cmd)
}

client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
Expand Down Expand Up @@ -323,7 +323,7 @@ func listWithdrawals(ctx context.Context, cmd *cli.Command) error {
return showCommandHelp(ctx, cmd)
}

client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
Expand Down Expand Up @@ -354,7 +354,7 @@ func listStaticAddressSwaps(ctx context.Context, cmd *cli.Command) error {
return showCommandHelp(ctx, cmd)
}

client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
Expand Down Expand Up @@ -388,7 +388,7 @@ func summary(ctx context.Context, cmd *cli.Command) error {
return showCommandHelp(ctx, cmd)
}

client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
Expand Down Expand Up @@ -519,7 +519,7 @@ func staticAddressLoopIn(ctx context.Context, cmd *cli.Command) error {
selectedAmount = int64(cmd.Uint64("amt"))
}

client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/loop/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func stopDaemon(ctx context.Context, cmd *cli.Command) error {
waitForShutdown := cmd.Bool("wait")

// Establish a client connection to loopd.
client, conn, cleanup, err := getClientWithConn(ctx, cmd)
client, conn, cleanup, err := getClientWithConn(cmd)
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/loop/swaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var listSwapsCommand = &cli.Command{
}

func listSwaps(ctx context.Context, cmd *cli.Command) error {
client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
Expand Down Expand Up @@ -164,7 +164,7 @@ func swapInfo(ctx context.Context, cmd *cli.Command) error {
return fmt.Errorf("cannot hex decode id: %v", err)
}

client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
Expand Down Expand Up @@ -226,7 +226,7 @@ func abandonSwap(ctx context.Context, cmd *cli.Command) error {
return fmt.Errorf("cannot hex decode id: %v", err)
}

client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/loop/terms.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var termsCommand = &cli.Command{
}

func terms(ctx context.Context, cmd *cli.Command) error {
client, cleanup, err := getClient(ctx, cmd)
client, cleanup, err := getClient(cmd)
if err != nil {
return err
}
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ require (
go.etcd.io/bbolt v1.4.3
golang.org/x/sync v0.18.0
google.golang.org/grpc v1.64.1
google.golang.org/protobuf v1.36.5
google.golang.org/protobuf v1.36.11
gopkg.in/macaroon-bakery.v2 v2.3.0
gopkg.in/macaroon.v2 v2.1.0
modernc.org/sqlite v1.34.5
Expand Down Expand Up @@ -150,7 +150,6 @@ require (
github.com/prometheus/procfs v0.8.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/rogpeppe/fastuuid v1.2.0 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/soheilhy/cmux v0.1.5 // indirect
Expand Down
Loading
Loading