Skip to content

Commit

Permalink
multi: Remove stakepool ticket purchasing.
Browse files Browse the repository at this point in the history
It was possible to set legacy stakepool options either through config or
through various RPC parameters, however the options either did nothing
or enabled behaviour which is no longer valid.

Breaking changes:

1. Removed PoolAddress and PoolFee parameters from gRPCs
   `purchasetickets` and `runticketbuyer`
1. Removed PoolAddress and PoolFee parameters from json-RPC
   `purchaseticket`
1. Removed config flags `--pooladdress` and `--poolfees`
  • Loading branch information
jholdstock committed Sep 9, 2024
1 parent 4c5cef6 commit ce78dfc
Show file tree
Hide file tree
Showing 15 changed files with 129 additions and 487 deletions.
28 changes: 7 additions & 21 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,13 @@ type config struct {
CPUProfile string `long:"cpuprofile" description:"Write cpu profile to the specified file"`

// Wallet options
WalletPass string `long:"walletpass" default-mask:"-" description:"Public wallet password; required when created with one"`
PromptPass bool `long:"promptpass" description:"Prompt for private passphase from terminal and unlock without timeout"`
Pass string `long:"pass" description:"Unlock with private passphrase"`
PromptPublicPass bool `long:"promptpublicpass" description:"Prompt for public passphrase from terminal"`
EnableTicketBuyer bool `long:"enableticketbuyer" description:"Enable the automatic ticket buyer"`
EnableVoting bool `long:"enablevoting" description:"Automatically vote on winning tickets"`
PurchaseAccount string `long:"purchaseaccount" description:"Account to autobuy tickets from"`
PoolAddress *cfgutil.AddressFlag `long:"pooladdress" description:"VSP fee address"`
poolAddress stdaddr.StakeAddress
PoolFees float64 `long:"poolfees" description:"VSP fee percentage (1.00 equals 1.00% fee)"`
WalletPass string `long:"walletpass" default-mask:"-" description:"Public wallet password; required when created with one"`
PromptPass bool `long:"promptpass" description:"Prompt for private passphase from terminal and unlock without timeout"`
Pass string `long:"pass" description:"Unlock with private passphrase"`
PromptPublicPass bool `long:"promptpublicpass" description:"Prompt for public passphrase from terminal"`
EnableTicketBuyer bool `long:"enableticketbuyer" description:"Enable the automatic ticket buyer"`
EnableVoting bool `long:"enablevoting" description:"Automatically vote on winning tickets"`
PurchaseAccount string `long:"purchaseaccount" description:"Account to autobuy tickets from"`
GapLimit uint32 `long:"gaplimit" description:"Allowed unused address gap between used addresses of accounts"`
WatchLast uint32 `long:"watchlast" description:"Limit watched previous addresses of each HD account branch"`
ManualTickets bool `long:"manualtickets" description:"Do not discover new tickets through network synchronization"`
Expand Down Expand Up @@ -380,7 +377,6 @@ func loadConfig(ctx context.Context) (*config, []string, error) {
GapLimit: defaultGapLimit,
AllowHighFees: defaultAllowHighFees,
RelayFee: cfgutil.NewAmountFlag(txrules.DefaultRelayFeePerKb),
PoolAddress: cfgutil.NewAddressFlag(),
AccountGapLimit: defaultAccountGapLimit,
DisableCoinTypeUpgrades: defaultDisableCoinTypeUpgrades,
CircuitLimit: defaultCircuitLimit,
Expand Down Expand Up @@ -556,7 +552,6 @@ func loadConfig(ctx context.Context) (*config, []string, error) {
flag *cfgutil.AddressFlag
addr *stdaddr.StakeAddress
}{
{cfg.PoolAddress, &cfg.poolAddress},
{cfg.TBOpts.VotingAddress, &cfg.TBOpts.votingAddress},
} {
addr, err := a.flag.StakeAddress(activeNet.Params)
Expand Down Expand Up @@ -692,15 +687,6 @@ func loadConfig(ctx context.Context) (*config, []string, error) {
return loadConfigError(err)
}

if cfg.PoolFees != 0.0 {
if !txrules.ValidPoolFeeRate(cfg.PoolFees) {
err := errors.E(errors.Invalid, errors.Errorf("pool fee rate %v", cfg.PoolFees))
fmt.Fprintln(os.Stderr, err.Error())
fmt.Fprintln(os.Stderr, usageMessage)
return loadConfigError(err)
}
}

ipNet := func(cidr string) net.IPNet {
_, ipNet, err := net.ParseCIDR(cidr)
if err != nil {
Expand Down
10 changes: 2 additions & 8 deletions dcrwallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,6 @@ func run(ctx context.Context) error {
stakeOptions := &ldr.StakeOptions{
VotingEnabled: cfg.EnableVoting,
VotingAddress: cfg.TBOpts.votingAddress,
PoolAddress: cfg.poolAddress,
PoolFees: cfg.PoolFees,
}
loader := ldr.NewLoader(activeNet.Params, dbDir, stakeOptions,
cfg.GapLimit, cfg.WatchLast, cfg.AllowHighFees, cfg.RelayFee.Amount,
Expand Down Expand Up @@ -316,14 +314,11 @@ func run(ctx context.Context) error {
changeAccount uint32 // (enableticketbuyer && mixing) || mixchange
ticketSplitAccount uint32 // enableticketbuyer && mixing

votingAddr = cfg.TBOpts.votingAddress
poolFeeAddr = cfg.poolAddress
votingAddr = cfg.TBOpts.votingAddress
)
if cfg.EnableTicketBuyer {
purchaseAccount = lookup("purchaseaccount", cfg.PurchaseAccount)
if cfg.Mixing {
poolFeeAddr = nil
}

if cfg.Mixing && cfg.TBOpts.VotingAccount == "" {
err := errors.New("cannot run mixed ticketbuyer without --votingaccount")
log.Error(err)
Expand Down Expand Up @@ -353,7 +348,6 @@ func run(ctx context.Context) error {
c.Account = purchaseAccount
c.Maintain = cfg.TBOpts.BalanceToMaintainAbsolute.Amount
c.VotingAddr = votingAddr
c.PoolFeeAddr = poolFeeAddr
c.Limit = int(cfg.TBOpts.Limit)
c.VotingAccount = votingAccount
c.Mixing = cfg.Mixing
Expand Down
8 changes: 0 additions & 8 deletions internal/loader/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ type Loader struct {
type StakeOptions struct {
VotingEnabled bool
VotingAddress stdaddr.StakeAddress
PoolAddress stdaddr.StakeAddress
PoolFees float64
}

// NewLoader constructs a Loader.
Expand Down Expand Up @@ -177,8 +175,6 @@ func (l *Loader) CreateWatchingOnlyWallet(ctx context.Context, extendedPubKey st
PubPassphrase: pubPass,
VotingEnabled: so.VotingEnabled,
VotingAddress: so.VotingAddress,
PoolAddress: so.PoolAddress,
PoolFees: so.PoolFees,
GapLimit: l.gapLimit,
WatchLast: l.watchLast,
AccountGapLimit: l.accountGapLimit,
Expand Down Expand Up @@ -269,8 +265,6 @@ func (l *Loader) CreateNewWallet(ctx context.Context, pubPassphrase, privPassphr
PubPassphrase: pubPassphrase,
VotingEnabled: so.VotingEnabled,
VotingAddress: so.VotingAddress,
PoolAddress: so.PoolAddress,
PoolFees: so.PoolFees,
GapLimit: l.gapLimit,
WatchLast: l.watchLast,
AccountGapLimit: l.accountGapLimit,
Expand Down Expand Up @@ -329,8 +323,6 @@ func (l *Loader) OpenExistingWallet(ctx context.Context, pubPassphrase []byte) (
PubPassphrase: pubPassphrase,
VotingEnabled: so.VotingEnabled,
VotingAddress: so.VotingAddress,
PoolAddress: so.PoolAddress,
PoolFees: so.PoolFees,
GapLimit: l.gapLimit,
WatchLast: l.watchLast,
AccountGapLimit: l.accountGapLimit,
Expand Down
25 changes: 0 additions & 25 deletions internal/rpc/jsonrpc/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -3313,29 +3313,6 @@ func (s *Server) purchaseTicket(ctx context.Context, icmd any) (any, error) {
}
}

// Set pool address if specified.
var poolAddr stdaddr.StakeAddress
var poolFee float64
if cmd.PoolAddress != nil && *cmd.PoolAddress != "" {
addr, err := decodeStakeAddress(*cmd.PoolAddress, w.ChainParams())
if err != nil {
return nil, err
}
poolAddr = addr

// Attempt to get the amount to send to
// the pool after.
if cmd.PoolFees == nil {
return nil, rpcErrorf(dcrjson.ErrRPCInvalidParameter,
"pool address set without pool fee")
}
poolFee = *cmd.PoolFees
if !txrules.ValidPoolFeeRate(poolFee) {
return nil, rpcErrorf(dcrjson.ErrRPCInvalidParameter,
"pool fee percentage %v", poolFee)
}
}

// Set the expiry if specified.
expiry := int32(0)
if cmd.Expiry != nil {
Expand Down Expand Up @@ -3405,8 +3382,6 @@ func (s *Server) purchaseTicket(ctx context.Context, icmd any) (any, error) {
MinConf: minConf,
Expiry: expiry,
DontSignTx: dontSignTx,
VSPAddress: poolAddr,
VSPFees: poolFee,

// CSPP
Mixing: mixing,
Expand Down
Loading

0 comments on commit ce78dfc

Please sign in to comment.