Skip to content
This repository has been archived by the owner on May 16, 2019. It is now read-only.

Commit

Permalink
Warn the user on start up (#7)
Browse files Browse the repository at this point in the history
The user is now warned on startup if the wallet is not connected
or unlocked.

Fixes #4.
  • Loading branch information
cjepson authored and alexlyp committed Jun 3, 2016
1 parent 700ecd3 commit 5cc29df
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,24 @@ func main() {
cfg.DcrwServ, cfg.DcrwUser, cfg.DcrwCert)
dcrwClient, err := dcrrpcclient.New(connCfgWallet, nil)
if err != nil {
fmt.Printf("Failed to start dcrd rpcclient: %s\n", err.Error())
fmt.Printf("Failed to start dcrw rpcclient: %s\n", err.Error())
os.Exit(1)
}

wi, err := dcrwClient.WalletInfo()
if err != nil {
fmt.Printf("Failed to get WalletInfo on start: %s\n", err.Error())
os.Exit(1)
}
if !wi.DaemonConnected {
log.Warnf("Wallet was not connected to a daemon at start up! " +
"Please ensure wallet has proper connectivity.")
}
if !wi.Unlocked {
log.Warnf("Wallet is not unlocked! You will need to unlock " +
"wallet for tickets to be purchased.")
}

err = syncGlobalsStartup(dcrdClient, dcrwClient, cfg)
if err != nil {
fmt.Printf("Failed to start sync globals on startup: %s\n", err.Error())
Expand Down

0 comments on commit 5cc29df

Please sign in to comment.