Skip to content

Commit 4d558b1

Browse files
committed
loop: expose server grpc connection
1 parent 091c0a8 commit 4d558b1

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

client.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"github.com/lightninglabs/loop/sweep"
2020
"github.com/lightningnetwork/lnd/lntypes"
2121
"github.com/lightningnetwork/lnd/routing/route"
22+
"google.golang.org/grpc"
2223
"google.golang.org/grpc/status"
2324
)
2425

@@ -148,6 +149,7 @@ func NewClient(dbDir string, loopDB loopdb.SwapStore,
148149
LndServices: cfg.Lnd,
149150
Server: swapServerClient,
150151
Store: loopDB,
152+
Conn: swapServerClient.conn,
151153
LsatStore: lsatStore,
152154
CreateExpiryTimer: func(d time.Duration) <-chan time.Time {
153155
return time.NewTimer(d).C
@@ -200,6 +202,11 @@ func NewClient(dbDir string, loopDB loopdb.SwapStore,
200202
return client, cleanup, nil
201203
}
202204

205+
// GetConn returns the gRPC connection to the server.
206+
func (s *Client) GetConn() *grpc.ClientConn {
207+
return s.clientConfig.Conn
208+
}
209+
203210
// FetchSwaps returns all loop in and out swaps currently in the database.
204211
func (s *Client) FetchSwaps(ctx context.Context) ([]*SwapInfo, error) {
205212
loopOutSwaps, err := s.Store.FetchLoopOutSwaps(ctx)

config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ import (
66
"github.com/lightninglabs/aperture/lsat"
77
"github.com/lightninglabs/lndclient"
88
"github.com/lightninglabs/loop/loopdb"
9+
"google.golang.org/grpc"
910
)
1011

1112
// clientConfig contains config items for the swap client.
1213
type clientConfig struct {
1314
LndServices *lndclient.LndServices
1415
Server swapServerClient
16+
Conn *grpc.ClientConn
1517
Store loopdb.SwapStore
1618
LsatStore lsat.Store
1719
CreateExpiryTimer func(expiry time.Duration) <-chan time.Time

0 commit comments

Comments
 (0)