Skip to content

Commit

Permalink
Shorten the param name balancetomaintainabsolute
Browse files Browse the repository at this point in the history
  • Loading branch information
vufon committed Jan 22, 2025
1 parent ce5dae7 commit a61788e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ type config struct {

type ticketBuyerOptions struct {
BalanceToMaintainAbsolute *cfgutil.AmountFlag `long:"balancetomaintainabsolute" description:"Amount of funds to keep in wallet when purchasing tickets"`
BalanceToMaintain *cfgutil.AmountFlag `long:"balancetomaintain" description:"Amount of funds to keep in wallet when purchasing tickets"`
Limit uint `long:"limit" description:"Buy no more than specified number of tickets per block"`
VotingAccount string `long:"votingaccount" description:"Account used to derive addresses specifying voting rights"`
}
Expand Down Expand Up @@ -380,8 +381,8 @@ func loadConfig(ctx context.Context) (*config, []string, error) {

// Ticket Buyer Options
TBOpts: ticketBuyerOptions{
BalanceToMaintainAbsolute: cfgutil.NewAmountFlag(defaultBalanceToMaintainAbsolute),
Limit: defaultTicketbuyerLimit,
BalanceToMaintain: cfgutil.NewAmountFlag(defaultBalanceToMaintainAbsolute),
Limit: defaultTicketbuyerLimit,
},

VSPOpts: vspOptions{
Expand Down Expand Up @@ -437,6 +438,12 @@ func loadConfig(ctx context.Context) (*config, []string, error) {
configFileError = err
}

if cfg.TBOpts.BalanceToMaintainAbsolute != nil {
log.Warn("The 'ticketbuyer.balancetomaintainabsolute' attribute in the config file is outdated. You should update it to 'ticketbuyer.balancetomaintain'")
} else {
cfg.TBOpts.BalanceToMaintainAbsolute = cfg.TBOpts.BalanceToMaintain
}

// Parse command line options again to ensure they take precedence.
remainingArgs, err := parser.Parse()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion sample-dcrwallet.conf
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
; ------------------------------------------------------------------------------

; Amount of funds to keep in wallet when stake mining
; ticketbuyer.balancetomaintainabsolute=0
; ticketbuyer.balancetomaintain=0

[VSP Options]

Expand Down

0 comments on commit a61788e

Please sign in to comment.