Skip to content

Commit

Permalink
state_client: add default timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
guggero committed Sep 19, 2024
1 parent ac6459a commit 8014a45
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lnd_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
5 changes: 4 additions & 1 deletion state_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"sync"
"time"

"github.com/lightningnetwork/lnd/lnrpc"
"google.golang.org/grpc"
Expand Down Expand Up @@ -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,
}
}

Expand Down

0 comments on commit 8014a45

Please sign in to comment.