@@ -350,6 +350,12 @@ var setParamsCommand = cli.Command{
350
350
Usage : "the target size of total local balance in " +
351
351
"satoshis, used by easy autoloop." ,
352
352
},
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
+ },
353
359
},
354
360
Action : setParams ,
355
361
}
@@ -515,14 +521,34 @@ func setParams(ctx *cli.Context) error {
515
521
flagSet = true
516
522
}
517
523
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 (ctx .String ("asset_id" )) {
528
+ if _ , ok := params .EasyAssetParams [ctx .String ("asset_id" )]; ! ok { //nolint:lll
529
+ params .EasyAssetParams [ctx .String ("asset_id" )] =
530
+ & looprpc.EasyAssetParams {}
531
+ }
532
+ }
533
+
518
534
if ctx .IsSet ("easyautoloop" ) {
519
- params .EasyAutoloop = ctx .Bool ("easyautoloop" )
535
+ if ctx .IsSet ("asset_id" ) {
536
+ params .EasyAssetParams [ctx .String ("asset_id" )].
537
+ Enabled = ctx .Bool ("easyautoloop" )
538
+ } else {
539
+ params .EasyAutoloop = ctx .Bool ("easyautoloop" )
540
+ }
520
541
flagSet = true
521
542
}
522
543
523
544
if ctx .IsSet ("localbalancesat" ) {
524
- params .EasyAutoloopLocalTargetSat =
525
- ctx .Uint64 ("localbalancesat" )
545
+ if ctx .IsSet ("asset_id" ) {
546
+ params .EasyAssetParams [ctx .String ("asset_id" )].
547
+ LocalTargetAssetAmt = ctx .Uint64 ("localbalancesat" ) // nolint:lll
548
+ } else {
549
+ params .EasyAutoloopLocalTargetSat =
550
+ ctx .Uint64 ("localbalancesat" )
551
+ }
526
552
flagSet = true
527
553
}
528
554
0 commit comments