diff --git a/cmd/raiju/raiju.go b/cmd/raiju/raiju.go index 9336de7..c38e27c 100644 --- a/cmd/raiju/raiju.go +++ b/cmd/raiju/raiju.go @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/lightning/lnd.go b/lightning/lnd.go index b4393c6..3e3479d 100644 --- a/lightning/lnd.go +++ b/lightning/lnd.go @@ -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, } }