@@ -350,6 +350,12 @@ var setParamsCommand = cli.Command{
350350 Usage : "the target size of total local balance in " +
351351 "satoshis, used by easy autoloop." ,
352352 },
353+ cli.StringFlag {
354+ Name : "asset_id" ,
355+ Usage : "If set to a valid asset ID, the easyautoloop " +
356+ "and localbalancesat flags will be set for the " +
357+ "specified asset." ,
358+ },
353359 },
354360 Action : setParams ,
355361}
@@ -515,14 +521,39 @@ func setParams(ctx *cli.Context) error {
515521 flagSet = true
516522 }
517523
524+ // If we are setting easy autoloop parameters, we need to ensure that
525+ // the asset ID is set, and that we have a valid entry in our params
526+ // map.
527+ if ctx .IsSet ("asset_id" ) {
528+ if params .EasyAssetParams == nil {
529+ params .EasyAssetParams = make (
530+ map [string ]* looprpc.EasyAssetParams ,
531+ )
532+ }
533+ if _ , ok := params .EasyAssetParams [ctx .String ("asset_id" )]; ! ok { //nolint:lll
534+ params .EasyAssetParams [ctx .String ("asset_id" )] =
535+ & looprpc.EasyAssetParams {}
536+ }
537+ }
538+
518539 if ctx .IsSet ("easyautoloop" ) {
519- params .EasyAutoloop = ctx .Bool ("easyautoloop" )
540+ if ctx .IsSet ("asset_id" ) {
541+ params .EasyAssetParams [ctx .String ("asset_id" )].
542+ Enabled = ctx .Bool ("easyautoloop" )
543+ } else {
544+ params .EasyAutoloop = ctx .Bool ("easyautoloop" )
545+ }
520546 flagSet = true
521547 }
522548
523549 if ctx .IsSet ("localbalancesat" ) {
524- params .EasyAutoloopLocalTargetSat =
525- ctx .Uint64 ("localbalancesat" )
550+ if ctx .IsSet ("asset_id" ) {
551+ params .EasyAssetParams [ctx .String ("asset_id" )].
552+ LocalTargetAssetAmt = ctx .Uint64 ("localbalancesat" ) // nolint:lll
553+ } else {
554+ params .EasyAutoloopLocalTargetSat =
555+ ctx .Uint64 ("localbalancesat" )
556+ }
526557 flagSet = true
527558 }
528559
0 commit comments