@ -36,8 +36,8 @@ func getParams(ctx *cli.Context) error {
return nil
return nil
}
}
var setLiquidity Param Command = cli . Command {
var setLiquidity Rule Command = cli . Command {
Name : "set param ",
Name : "set rule ",
Usage : "set liquidity manager rule for a channel" ,
Usage : "set liquidity manager rule for a channel" ,
Description : "Update or remove the liquidity rule for a channel." ,
Description : "Update or remove the liquidity rule for a channel." ,
ArgsUsage : "shortchanid" ,
ArgsUsage : "shortchanid" ,
@ -58,10 +58,10 @@ var setLiquidityParamCommand = cli.Command{
Usage : "remove the rule currently set for the channel." ,
Usage : "remove the rule currently set for the channel." ,
} ,
} ,
} ,
} ,
Action : set Param ,
Action : set Rule ,
}
}
func set Param ( ctx * cli . Context ) error {
func set Rule ( ctx * cli . Context ) error {
// We require that a channel ID is set for this rule update.
// We require that a channel ID is set for this rule update.
if ctx . NArg ( ) != 1 {
if ctx . NArg ( ) != 1 {
return fmt . Errorf ( "please set a channel id for the rule " +
return fmt . Errorf ( "please set a channel id for the rule " +
@ -122,12 +122,11 @@ func setParam(ctx *cli.Context) error {
"flag" )
"flag" )
}
}
params . Rules = otherRules
_ , err = client . SetLiquidityParams (
_ , err = client . SetLiquidityParams (
context . Background ( ) ,
context . Background ( ) ,
& looprpc . SetLiquidityParamsRequest {
& looprpc . SetLiquidityParamsRequest {
Parameters : & looprpc . LiquidityParameters {
Parameters : params ,
Rules : otherRules ,
} ,
} ,
} ,
)
)
return err
return err
@ -158,13 +157,16 @@ func setParam(ctx *cli.Context) error {
)
)
}
}
// Just set the rules on our current set of parameters and leave the
// other values untouched.
otherRules = append ( otherRules , newRule )
params . Rules = otherRules
// Update our parameters to the existing set, plus our new rule.
// Update our parameters to the existing set, plus our new rule.
_ , err = client . SetLiquidityParams (
_ , err = client . SetLiquidityParams (
context . Background ( ) ,
context . Background ( ) ,
& looprpc . SetLiquidityParamsRequest {
& looprpc . SetLiquidityParamsRequest {
Parameters : & looprpc . LiquidityParameters {
Parameters : params ,
Rules : append ( otherRules , newRule ) ,
} ,
} ,
} ,
)
)