Skip to content

Commit 58bbe5c

Browse files
committed
state_client: add default timeout
1 parent f149cfe commit 58bbe5c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lnd_services.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ func NewLndServices(cfg *LndServicesConfig) (*GrpcLndServices, error) {
307307
}
308308

309309
basicClient := lnrpc.NewLightningClient(conn)
310-
stateClient := newStateClient(conn, readonlyMac)
310+
stateClient := newStateClient(conn, readonlyMac, timeout)
311311
versionerClient := newVersionerClient(conn, readonlyMac, timeout)
312312

313313
cleanupConn := func() {

state_client.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"sync"
7+
"time"
78

89
"github.com/lightningnetwork/lnd/lnrpc"
910
"google.golang.org/grpc"
@@ -90,17 +91,19 @@ func (s WalletState) ReadyForGetInfo() bool {
9091
type stateClient struct {
9192
client lnrpc.StateClient
9293
readonlyMac serializedMacaroon
94+
timeout time.Duration
9395

9496
wg sync.WaitGroup
9597
}
9698

9799
// newStateClient returns a new stateClient.
98100
func newStateClient(conn grpc.ClientConnInterface,
99-
readonlyMac serializedMacaroon) *stateClient {
101+
readonlyMac serializedMacaroon, timeout time.Duration) *stateClient {
100102

101103
return &stateClient{
102104
client: lnrpc.NewStateClient(conn),
103105
readonlyMac: readonlyMac,
106+
timeout: timeout,
104107
}
105108
}
106109

0 commit comments

Comments
 (0)