99
1010 "github.com/lightninglabs/loop/liquidity"
1111 "github.com/lightninglabs/loop/looprpc"
12+ "github.com/lightninglabs/loop/swap"
1213 "github.com/lightningnetwork/lnd/routing/route"
1314 "github.com/urfave/cli"
1415 "google.golang.org/grpc/codes"
@@ -106,7 +107,7 @@ func setRule(ctx *cli.Context) error {
106107 // We need to set the full set of current parameters every time we call
107108 // SetParameters. To allow users to set only individual fields on the
108109 // cli, we lookup our current params, then update individual values.
109- params , err := client .GetLiquidityParams (
110+ paramsResponse , err := client .GetLiquidityParams (
110111 context .Background (), & looprpc.GetLiquidityParamsRequest {},
111112 )
112113 if err != nil {
@@ -120,6 +121,12 @@ func setRule(ctx *cli.Context) error {
120121 otherRules []* looprpc.LiquidityRule
121122 )
122123
124+ // We're only interested in the btc rules for now.
125+ params , ok := paramsResponse .Rules [swap .DefaultBtcAssetID ]
126+ if ! ok {
127+ return errors .New ("no rules set for BTC" )
128+ }
129+
123130 // Run through our current set of rules and check whether we have a rule
124131 // currently set for this channel or peer. We also track a slice
125132 // containing all of the rules we currently have set for other channels,
@@ -160,6 +167,7 @@ func setRule(ctx *cli.Context) error {
160167 context .Background (),
161168 & looprpc.SetLiquidityParamsRequest {
162169 Parameters : params ,
170+ AssetId : swap .DefaultBtcAssetID ,
163171 },
164172 )
165173 return err
@@ -216,6 +224,7 @@ func setRule(ctx *cli.Context) error {
216224 context .Background (),
217225 & looprpc.SetLiquidityParamsRequest {
218226 Parameters : params ,
227+ AssetId : swap .DefaultBtcAssetID ,
219228 },
220229 )
221230
@@ -364,13 +373,19 @@ func setParams(ctx *cli.Context) error {
364373 // We need to set the full set of current parameters every time we call
365374 // SetParameters. To allow users to set only individual fields on the
366375 // cli, we lookup our current params, then update individual values.
367- params , err := client .GetLiquidityParams (
376+ paramsResponse , err := client .GetLiquidityParams (
368377 context .Background (), & looprpc.GetLiquidityParamsRequest {},
369378 )
370379 if err != nil {
371380 return err
372381 }
373382
383+ // We're only interested in the btc rules for now.
384+ params , ok := paramsResponse .Rules [swap .DefaultBtcAssetID ]
385+ if ! ok {
386+ return errors .New ("no rules set for BTC" )
387+ }
388+
374389 var flagSet , categoriesSet , feePercentSet bool
375390
376391 // Update our existing parameters with the values provided by cli flags.
@@ -556,6 +571,7 @@ func setParams(ctx *cli.Context) error {
556571 _ , err = client .SetLiquidityParams (
557572 context .Background (), & looprpc.SetLiquidityParamsRequest {
558573 Parameters : params ,
574+ AssetId : swap .DefaultBtcAssetID ,
559575 },
560576 )
561577
0 commit comments