cmd+looprpc: add new parameters for easy autoloop

This commit introduces the new parameters to the protofiles and the
cmd interface. If easy autoloop is enabled we just ignore the rest of
the rules and use the defaults of easy autoloop.
This commit is contained in:
George Tsagkarelis 2023-04-11 15:13:06 +03:00
parent 0a19485409
commit cd9f6f142b
No known key found for this signature in database
GPG key ID: 0807D1013F48208A
4 changed files with 241 additions and 163 deletions

View file

@ -324,6 +324,17 @@ var setParamsCommand = cli.Command{
Usage: "the confirmation target for loop in on-chain " +
"htlcs",
},
cli.BoolFlag{
Name: "easyautoloop",
Usage: "set to true to enable easy autoloop, which " +
"will automatically dispatch swaps in order " +
"to meet the target local balance",
},
cli.Uint64Flag{
Name: "localbalancesat",
Usage: "the target size of total local balance in " +
"satoshis, used by easy autoloop",
},
},
Action: setParams,
}
@ -465,6 +476,17 @@ func setParams(ctx *cli.Context) error {
flagSet = true
}
if ctx.IsSet("easyautoloop") {
params.EasyAutoloop = ctx.Bool("easyautoloop")
flagSet = true
}
if ctx.IsSet("localbalancesat") {
params.EasyAutoloopLocalTargetSat =
ctx.Uint64("localbalancesat")
flagSet = true
}
if !flagSet {
return fmt.Errorf("at least one flag required to set params")
}