Skip to content

Commit

Permalink
Lnd factory
Browse files Browse the repository at this point in the history
  • Loading branch information
nyonson committed May 9, 2023
1 parent 53340c8 commit d6ea3f4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
18 changes: 10 additions & 8 deletions cmd/raiju/raiju.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ func main() {
RPCTimeout: rpcTimeout,
}
services, err := lndclient.NewLndServices(cfg)

if err != nil {
return err
}
defer services.Close()

c := lightning.NewLndClient(services.Client, services.Client, services.Router, *network)
c := lightning.NewLndClient(services, *network)
f, err := parseFees(*liquidityThresholds, *liquidityFees, *liquidityStickiness)
if err != nil {
return err
Expand Down Expand Up @@ -179,12 +179,12 @@ func main() {
RPCTimeout: rpcTimeout,
}
services, err := lndclient.NewLndServices(cfg)

if err != nil {
return err
}
defer services.Close()

c := lightning.NewLndClient(services.Client, services.Client, services.Router, *network)
c := lightning.NewLndClient(services, *network)
f, err := parseFees(*liquidityThresholds, *liquidityFees, *liquidityStickiness)
if err != nil {
return err
Expand Down Expand Up @@ -259,8 +259,9 @@ func main() {
if err != nil {
return err
}
defer services.Close()

c := lightning.NewLndClient(services.Client, services.Client, services.Router, *network)
c := lightning.NewLndClient(services, *network)
f, err := parseFees(*liquidityThresholds, *liquidityFees, *liquidityStickiness)
if err != nil {
return err
Expand Down Expand Up @@ -319,12 +320,12 @@ func main() {
RPCTimeout: rpcTimeout,
}
services, err := lndclient.NewLndServices(cfg)

if err != nil {
return err
}
defer services.Close()

c := lightning.NewLndClient(services.Client, services.Client, services.Router, *network)
c := lightning.NewLndClient(services, *network)
f, err := parseFees(*liquidityThresholds, *liquidityFees, *liquidityStickiness)
if err != nil {
return err
Expand Down Expand Up @@ -366,8 +367,9 @@ func main() {
if err != nil {
return err
}
defer services.Close()

c := lightning.NewLndClient(services.Client, services.Client, services.Router, *network)
c := lightning.NewLndClient(services, *network)
f, err := parseFees(*liquidityThresholds, *liquidityFees, *liquidityStickiness)
if err != nil {
return err
Expand Down
8 changes: 4 additions & 4 deletions lightning/lnd.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ type invoicer interface {
}

// NewLndClient backed by a single LND lightning node.
func NewLndClient(c channeler, i invoicer, r router, network string) LndClient {
func NewLndClient(s *lndclient.GrpcLndServices, network string) LndClient {
return LndClient{
c: c,
i: i,
r: r,
c: s.Client,
i: s.Client,
r: s.Router,
network: network,
}
}
Expand Down

0 comments on commit d6ea3f4

Please sign in to comment.