From 201950e8523a4ca1ae81002a81638c4881b46a75 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Wed, 24 Jul 2024 16:45:03 +0200 Subject: [PATCH] state_client: add default timeout --- lnd_services.go | 2 +- state_client.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lnd_services.go b/lnd_services.go index 40a6c66..b417399 100644 --- a/lnd_services.go +++ b/lnd_services.go @@ -307,7 +307,7 @@ func NewLndServices(cfg *LndServicesConfig) (*GrpcLndServices, error) { } basicClient := lnrpc.NewLightningClient(conn) - stateClient := newStateClient(conn, readonlyMac) + stateClient := newStateClient(conn, readonlyMac, timeout) versionerClient := newVersionerClient(conn, readonlyMac, timeout) cleanupConn := func() { diff --git a/state_client.go b/state_client.go index 498ecb7..18abe28 100644 --- a/state_client.go +++ b/state_client.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "sync" + "time" "github.com/lightningnetwork/lnd/lnrpc" "google.golang.org/grpc" @@ -90,17 +91,19 @@ func (s WalletState) ReadyForGetInfo() bool { type stateClient struct { client lnrpc.StateClient readonlyMac serializedMacaroon + timeout time.Duration wg sync.WaitGroup } // newStateClient returns a new stateClient. func newStateClient(conn grpc.ClientConnInterface, - readonlyMac serializedMacaroon) *stateClient { + readonlyMac serializedMacaroon, timeout time.Duration) *stateClient { return &stateClient{ client: lnrpc.NewStateClient(conn), readonlyMac: readonlyMac, + timeout: timeout, } }