Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ var (
dcrstakepoolHomeDir = dcrutil.AppDataDir("dcrstakepool", false)
defaultConfigFile = filepath.Join(dcrstakepoolHomeDir, defaultConfigFilename)
defaultLogDir = filepath.Join(dcrstakepoolHomeDir, defaultLogDirname)
coldWalletFeeKey *hdkeychain.ExtendedKey
votingWalletVoteKey *hdkeychain.ExtendedKey
)

// runServiceCommand is only set to a real function on Windows. It is used
Expand Down Expand Up @@ -106,6 +104,9 @@ type config struct {
MaxVotedTickets int `long:"maxvotedtickets" description:"Maximum number of voted tickets to show on tickets page."`
Description string `long:"description" description:"Operators own description of their VSP"`
Designation string `long:"designation" description:"VSP designation (eg. Alpha, Bravo, etc)"`

coldWalletFeeKey *hdkeychain.ExtendedKey
votingWalletVoteKey *hdkeychain.ExtendedKey
}

// serviceOptions defines the configuration options for the daemon as a service
Expand Down Expand Up @@ -260,12 +261,12 @@ func fileExists(name string) bool {
func (c *config) parsePubKeys(params *chaincfg.Params) error {
// Parse the extended public key and the pool fees.
var err error
coldWalletFeeKey, err = hdkeychain.NewKeyFromString(c.ColdWalletExtPub, params)
c.coldWalletFeeKey, err = hdkeychain.NewKeyFromString(c.ColdWalletExtPub, params)
if err != nil {
return fmt.Errorf("cold wallet extended public key: %v", err)
}
// Parse the extended public key for the voting addresses.
votingWalletVoteKey, err = hdkeychain.NewKeyFromString(c.VotingWalletExtPub, params)
c.votingWalletVoteKey, err = hdkeychain.NewKeyFromString(c.VotingWalletExtPub, params)
if err != nil {
return fmt.Errorf("voting wallet extended public key: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ func TestParsePubKeys(t *testing.T) {
//testing func
err := cfg.parsePubKeys(test.params)
//err if expected output key strings and real output key strings don't match or expected error status is different
if strFromHd(test.keysOut.coldFeeWallet) != strFromHd(coldWalletFeeKey) || strFromHd(test.keysOut.voteWallet) != strFromHd(votingWalletVoteKey) || (err != nil) != test.isError {
t.Error("for", test.keysIn, "expected", strFromHd(test.keysOut.coldFeeWallet), strFromHd(test.keysOut.voteWallet), "and is error=", test.isError, "got", strFromHd(coldWalletFeeKey), strFromHd(votingWalletVoteKey), "and is error=", err != nil)
if strFromHd(test.keysOut.coldFeeWallet) != strFromHd(cfg.coldWalletFeeKey) || strFromHd(test.keysOut.voteWallet) != strFromHd(cfg.votingWalletVoteKey) || (err != nil) != test.isError {
t.Error("for", test.keysIn, "expected", strFromHd(test.keysOut.coldFeeWallet), strFromHd(test.keysOut.voteWallet), "and is error=", test.isError, "got", strFromHd(cfg.coldWalletFeeKey), strFromHd(cfg.votingWalletVoteKey), "and is error=", err != nil)
}
}
}
4 changes: 2 additions & 2 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ func runMain(ctx context.Context) error {
Designation: cfg.Designation,

APIVersionsSupported: APIVersionsSupported,
FeeXpub: coldWalletFeeKey,
FeeXpub: cfg.coldWalletFeeKey,
StakepooldServers: stakepooldConnMan,
EmailSender: sender,
VotingXpub: votingWalletVoteKey,
VotingXpub: cfg.votingWalletVoteKey,
NetParams: activeNetParams.Params,
}

Expand Down