mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
loopd: recorgnize maxlsatcost and maxlsatfee flags
The flags were re-added in hidden mode so that users who specified them could start the daemon after upgrading. If a flag is used, a deprecation warning is printed. Updated release_notes.md.
This commit is contained in:
parent
0e7927ac96
commit
7bb04ae6ac
3 changed files with 34 additions and 2 deletions
|
|
@ -160,6 +160,8 @@ type Config struct {
|
|||
MaxLogFileSize int `long:"maxlogfilesize" description:"Maximum logfile size in MB."`
|
||||
|
||||
DebugLevel string `long:"debuglevel" description:"Logging level for all subsystems {trace, debug, info, warn, error, critical} -- You may also specify <subsystem>=<level>,<subsystem2>=<level>,... to set the log level for individual subsystems -- Use show to list available subsystems"`
|
||||
MaxLSATCost uint32 `long:"maxlsatcost" hidden:"true"`
|
||||
MaxLSATFee uint32 `long:"maxlsatfee" hidden:"true"`
|
||||
MaxL402Cost uint32 `long:"maxl402cost" description:"Maximum cost in satoshis that loopd is going to pay for an L402 token automatically. Does not include routing fees."`
|
||||
MaxL402Fee uint32 `long:"maxl402fee" description:"Maximum routing fee in satoshis that we are willing to pay while paying for an L402 token."`
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import (
|
|||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/lightninglabs/aperture/l402"
|
||||
"github.com/lightninglabs/lndclient"
|
||||
"github.com/lightninglabs/loop"
|
||||
"github.com/lightninglabs/loop/liquidity"
|
||||
|
|
@ -21,6 +22,23 @@ func getClient(cfg *Config, swapDb loopdb.SwapStore,
|
|||
sweeperDb sweepbatcher.BatcherStore, lnd *lndclient.LndServices) (
|
||||
*loop.Client, func(), error) {
|
||||
|
||||
// Default is not set for MaxLSATCost and MaxLSATFee to distinguish
|
||||
// it from user explicitly setting the option to default value.
|
||||
// So if MaxL402Cost and MaxLSATFee are not set in the config file
|
||||
// and command line, they are set to 0.
|
||||
const (
|
||||
defaultCost = l402.DefaultMaxCostSats
|
||||
defaultFee = l402.DefaultMaxRoutingFeeSats
|
||||
)
|
||||
if cfg.MaxL402Cost != defaultCost && cfg.MaxLSATCost != 0 {
|
||||
return nil, nil, fmt.Errorf("both maxl402cost and maxlsatcost" +
|
||||
" were specified; they are not allowed together")
|
||||
}
|
||||
if cfg.MaxL402Fee != defaultFee && cfg.MaxLSATFee != 0 {
|
||||
return nil, nil, fmt.Errorf("both maxl402fee and maxlsatfee" +
|
||||
" were specified; they are not allowed together")
|
||||
}
|
||||
|
||||
clientConfig := &loop.ClientConfig{
|
||||
ServerAddress: cfg.Server.Host,
|
||||
ProxyAddress: cfg.Server.Proxy,
|
||||
|
|
@ -34,6 +52,17 @@ func getClient(cfg *Config, swapDb loopdb.SwapStore,
|
|||
MaxPaymentRetries: cfg.MaxPaymentRetries,
|
||||
}
|
||||
|
||||
if cfg.MaxL402Cost == defaultCost && cfg.MaxLSATCost != 0 {
|
||||
log.Warnf("Option maxlsatcost is deprecated and will be " +
|
||||
"removed. Switch to maxl402cost.")
|
||||
clientConfig.MaxL402Cost = btcutil.Amount(cfg.MaxLSATCost)
|
||||
}
|
||||
if cfg.MaxL402Fee == defaultFee && cfg.MaxLSATFee != 0 {
|
||||
log.Warnf("Option maxlsatfee is deprecated and will be " +
|
||||
"removed. Switch to maxl402fee.")
|
||||
clientConfig.MaxL402Fee = btcutil.Amount(cfg.MaxLSATFee)
|
||||
}
|
||||
|
||||
swapClient, cleanUp, err := loop.NewClient(
|
||||
cfg.DataDir, swapDb, sweeperDb, clientConfig,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue