Skip to content

Commit 5f42c09

Browse files
fix build errors after rebase
1 parent 98ae593 commit 5f42c09

File tree

2 files changed

+51
-59
lines changed

2 files changed

+51
-59
lines changed

config.go

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -67,50 +67,50 @@ var runServiceCommand func(string) error
6767
//
6868
// See loadConfig for details on the configuration load process.
6969
type config struct {
70-
ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"`
71-
ConfigFile string `short:"C" long:"configfile" description:"Path to configuration file"`
72-
DataDir string `short:"b" long:"datadir" description:"Directory to store data"`
73-
LogDir string `long:"logdir" description:"Directory to log output."`
74-
Listen string `long:"listen" description:"Listen for connections on the specified interface/port (default all interfaces port: 9113, testnet: 19113)"`
75-
TestNet bool `long:"testnet" description:"Use the test network"`
76-
SimNet bool `long:"simnet" description:"Use the simulation test network"`
77-
Profile string `long:"profile" description:"Enable HTTP profiling on given port -- NOTE port must be between 1024 and 65536"`
78-
CPUProfile string `long:"cpuprofile" description:"Write CPU profile to the specified file"`
79-
MemProfile string `long:"memprofile" description:"Write mem profile to the specified file"`
80-
DebugLevel string `short:"d" 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"`
81-
APISecret string `long:"apisecret" description:"Secret string used to encrypt API tokens."`
82-
BaseURL string `long:"baseurl" description:"BaseURL to use when sending links via email"`
70+
ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"`
71+
ConfigFile string `short:"C" long:"configfile" description:"Path to configuration file"`
72+
DataDir string `short:"b" long:"datadir" description:"Directory to store data"`
73+
LogDir string `long:"logdir" description:"Directory to log output."`
74+
Listen string `long:"listen" description:"Listen for connections on the specified interface/port (default all interfaces port: 9113, testnet: 19113)"`
75+
TestNet bool `long:"testnet" description:"Use the test network"`
76+
SimNet bool `long:"simnet" description:"Use the simulation test network"`
77+
Profile string `long:"profile" description:"Enable HTTP profiling on given port -- NOTE port must be between 1024 and 65536"`
78+
CPUProfile string `long:"cpuprofile" description:"Write CPU profile to the specified file"`
79+
MemProfile string `long:"memprofile" description:"Write mem profile to the specified file"`
80+
DebugLevel string `short:"d" 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"`
81+
APISecret string `long:"apisecret" description:"Secret string used to encrypt API tokens."`
82+
BaseURL string `long:"baseurl" description:"BaseURL to use when sending links via email"`
8383
// todo: can `ColdWalletExtPub` and `PoolFees` be read from stakepoold via rpc?
84-
ColdWalletExtPub string `long:"coldwalletextpub" description:"The extended public key for addresses to which voting service user fees are sent."`
85-
ClosePool bool `long:"closepool" description:"Disable user registration actions (sign-ups and submitting addresses)"`
86-
ClosePoolMsg string `long:"closepoolmsg" description:"Message to display when closepool is set."`
87-
CookieSecret string `long:"cookiesecret" description:"Secret string used to encrypt session data."`
88-
CookieSecure bool `long:"cookiesecure" description:"Set whether cookies can be sent in clear text or not."`
89-
DBHost string `long:"dbhost" description:"Hostname for database connection"`
90-
DBUser string `long:"dbuser" description:"Username for database connection"`
91-
DBPassword string `long:"dbpassword" description:"Password for database connection"`
92-
DBPort string `long:"dbport" description:"Port for database connection"`
93-
DBName string `long:"dbname" description:"Name of database"`
94-
PublicPath string `long:"publicpath" description:"Path to the public folder which contains css/fonts/images/javascript."`
95-
TemplatePath string `long:"templatepath" description:"Path to the views folder which contains html files."`
96-
PoolEmail string `long:"poolemail" description:"Email address to for support inquiries"`
97-
PoolFees float64 `long:"poolfees" description:"The per-ticket fees the user must send to the pool with their tickets"`
98-
PoolLink string `long:"poollink" description:"URL for support inquiries such as forum, IRC, etc"`
99-
RealIPHeader string `long:"realipheader" description:"The name of an HTTP request header containing the actual remote client IP address, typically set by a reverse proxy. An empty string (default) indicates to use net/Request.RemodeAddr."`
100-
SMTPFrom string `long:"smtpfrom" description:"From address to use on outbound mail"`
101-
SMTPHost string `long:"smtphost" description:"SMTP hostname/ip and port, e.g. mail.example.com:25"`
102-
SMTPUsername string `long:"smtpusername" description:"SMTP username for authentication if required"`
103-
SMTPPassword string `long:"smtppassword" description:"SMTP password for authentication if required"`
104-
UseSMTPS bool `long:"usesmtps" description:"Connect to the SMTP server using smtps."`
105-
SMTPSkipVerify bool `long:"smtpskipverify" description:"Skip SMTP TLS cert verification. Will only skip if SMTPCert is empty"`
106-
SMTPCert string `long:"smtpcert" description:"Path for the smtp certificate file"`
107-
SystemCerts *x509.CertPool
108-
StakepooldHosts []string `long:"stakepooldhosts" description:"Hostnames for stakepoold servers"`
109-
StakepooldCerts []string `long:"stakepooldcerts" description:"Certificate paths for stakepoold servers"`
110-
WalletHosts []string `long:"wallethosts" description:"Deprecated: dcrstakepool no longer connects to dcrwallet"`
111-
WalletUsers []string `long:"walletusers" description:"Deprecated: dcrstakepool no longer connects to dcrwallet"`
112-
WalletPasswords []string `long:"walletpasswords" description:"Deprecated: dcrstakepool no longer connects to dcrwallet"`
113-
WalletCerts []string `long:"walletcerts" description:"Deprecated: dcrstakepool no longer connects to dcrwallet"`
84+
ColdWalletExtPub string `long:"coldwalletextpub" description:"The extended public key for addresses to which voting service user fees are sent."`
85+
ClosePool bool `long:"closepool" description:"Disable user registration actions (sign-ups and submitting addresses)"`
86+
ClosePoolMsg string `long:"closepoolmsg" description:"Message to display when closepool is set."`
87+
CookieSecret string `long:"cookiesecret" description:"Secret string used to encrypt session data."`
88+
CookieSecure bool `long:"cookiesecure" description:"Set whether cookies can be sent in clear text or not."`
89+
DBHost string `long:"dbhost" description:"Hostname for database connection"`
90+
DBUser string `long:"dbuser" description:"Username for database connection"`
91+
DBPassword string `long:"dbpassword" description:"Password for database connection"`
92+
DBPort string `long:"dbport" description:"Port for database connection"`
93+
DBName string `long:"dbname" description:"Name of database"`
94+
PublicPath string `long:"publicpath" description:"Path to the public folder which contains css/fonts/images/javascript."`
95+
TemplatePath string `long:"templatepath" description:"Path to the views folder which contains html files."`
96+
PoolEmail string `long:"poolemail" description:"Email address to for support inquiries"`
97+
PoolFees float64 `long:"poolfees" description:"The per-ticket fees the user must send to the pool with their tickets"`
98+
PoolLink string `long:"poollink" description:"URL for support inquiries such as forum, IRC, etc"`
99+
RealIPHeader string `long:"realipheader" description:"The name of an HTTP request header containing the actual remote client IP address, typically set by a reverse proxy. An empty string (default) indicates to use net/Request.RemodeAddr."`
100+
SMTPFrom string `long:"smtpfrom" description:"From address to use on outbound mail"`
101+
SMTPHost string `long:"smtphost" description:"SMTP hostname/ip and port, e.g. mail.example.com:25"`
102+
SMTPUsername string `long:"smtpusername" description:"SMTP username for authentication if required"`
103+
SMTPPassword string `long:"smtppassword" description:"SMTP password for authentication if required"`
104+
UseSMTPS bool `long:"usesmtps" description:"Connect to the SMTP server using smtps."`
105+
SMTPSkipVerify bool `long:"smtpskipverify" description:"Skip SMTP TLS cert verification. Will only skip if SMTPCert is empty"`
106+
SMTPCert string `long:"smtpcert" description:"Path for the smtp certificate file"`
107+
SystemCerts *x509.CertPool
108+
StakepooldHosts []string `long:"stakepooldhosts" description:"Hostnames for stakepoold servers"`
109+
StakepooldCerts []string `long:"stakepooldcerts" description:"Certificate paths for stakepoold servers"`
110+
WalletHosts []string `long:"wallethosts" description:"Deprecated: dcrstakepool no longer connects to dcrwallet"`
111+
WalletUsers []string `long:"walletusers" description:"Deprecated: dcrstakepool no longer connects to dcrwallet"`
112+
WalletPasswords []string `long:"walletpasswords" description:"Deprecated: dcrstakepool no longer connects to dcrwallet"`
113+
WalletCerts []string `long:"walletcerts" description:"Deprecated: dcrstakepool no longer connects to dcrwallet"`
114114
// todo: `VotingWalletExtPub` can be read from the vsp backend dcrwallet via stakepoold rpc instead!
115115
VotingWalletExtPub string `long:"votingwalletextpub" description:"The extended public key of the default account of the voting wallet"`
116116
AdminIPs []string `long:"adminips" description:"Expected admin host"`

controllers/main.go

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ func (controller *MainController) APIAddress(c web.C, r *http.Request) ([]string
362362
return nil, codes.Unavailable, "system error", errors.New("unable to process wallet commands")
363363
}
364364

365-
userFeeAddr, err := controller.FeeAddressForUserID(userId)
365+
userFeeAddr, err := controller.FeeAddressForUserID(int(user.Id))
366366
if err != nil {
367367
log.Warnf("unexpected error deriving pool addr: %s", err.Error())
368368
return nil, codes.Unavailable, "system error", errors.New("unable to process wallet commands")
@@ -386,8 +386,7 @@ func (controller *MainController) APIAddress(c web.C, r *http.Request) ([]string
386386
func (controller *MainController) APIPurchaseTicket(c web.C, r *http.Request) (*poolapi.PurchaseInfo, codes.Code, string, error) {
387387
userPubKeyAddr := r.FormValue("UserPubKeyAddr")
388388

389-
u, err := validateUserPubKeyAddr(userPubKeyAddr)
390-
if err != nil {
389+
if _, err := validateUserPubKeyAddr(userPubKeyAddr); err != nil {
391390
return nil, codes.InvalidArgument, "address error", err
392391
}
393392

@@ -417,7 +416,7 @@ func (controller *MainController) APIPurchaseTicket(c web.C, r *http.Request) (*
417416
remoteIP := getClientIP(r, controller.realIPHeader)
418417
log.Infof("APIPurchaseTicket POST from %v, created new user account %v. Inserting.", remoteIP, user.Email)
419418

420-
err = models.InsertUser(dbMap, user)
419+
err := models.InsertUser(dbMap, user)
421420
if err != nil {
422421
log.Errorf("Error while creating new user account for ticket purchase: %v", err)
423422
return nil, codes.Unavailable, "system error", errors.New("unable to setup db entry for purchase")
@@ -428,7 +427,7 @@ func (controller *MainController) APIPurchaseTicket(c web.C, r *http.Request) (*
428427
userId := int(user.Id)
429428

430429
// Get the ticket address for this user
431-
pooladdress, err := controller.TicketAddressForUserID(userId)
430+
pooladdress, err := controller.TicketAddressForUserID(int(user.Id))
432431
if err != nil {
433432
log.Errorf("unable to derive ticket address: %v", err)
434433
return nil, codes.Unavailable, "system error", errors.New("unable to process wallet commands")
@@ -447,29 +446,22 @@ func (controller *MainController) APIPurchaseTicket(c web.C, r *http.Request) (*
447446

448447
poolPubKeyAddr := poolValidateAddress.PubKeyAddr
449448

450-
p, err := dcrutil.DecodeAddress(poolPubKeyAddr)
451-
if err != nil {
452-
controller.handlePotentialFatalError("DecodeAddress poolPubKeyAddr", err)
449+
if _, err = dcrutil.DecodeAddress(poolPubKeyAddr); err != nil {
453450
return nil, codes.Unavailable, "system error", errors.New("unable to process wallet commands")
454451
}
455452

456-
if controller.RPCIsStopped() {
457-
return nil, codes.Unavailable, "system error", errors.New("unable to process wallet commands")
458-
}
459-
createMultiSig, err := controller.rpcServers.CreateMultisig(1, []dcrutil.Address{p, u})
453+
createMultiSig, err := controller.StakepooldServers.CreateMultisig([]string{poolPubKeyAddr, userPubKeyAddr})
460454
if err != nil {
461-
controller.handlePotentialFatalError("CreateMultisig", err)
462455
return nil, codes.Unavailable, "system error", errors.New("unable to process wallet commands")
463456
}
464457

465-
// Serialize the RedeemScript (hex string -> []byte)
458+
// Serialize the redeem script (hex string -> []byte)
466459
serializedScript, err := hex.DecodeString(createMultiSig.RedeemScript)
467460
if err != nil {
468-
controller.handlePotentialFatalError("CreateMultisig DecodeString", err)
469461
return nil, codes.Unavailable, "system error", errors.New("unable to process wallet commands")
470462
}
471463

472-
// Import the RedeemScript
464+
// Import the redeem script
473465
var importedHeight int64
474466
importedHeight, err = controller.StakepooldServers.ImportScript(serializedScript)
475467
if err != nil {

0 commit comments

Comments
 (0)