Skip to content

Commit

Permalink
Address a few more review items.
Browse files Browse the repository at this point in the history
- Distinguish between missing address and database error
- Wrap help text for wallet generation seed
- Don't rescan if there are no addresses
  • Loading branch information
tuxcanfly authored and davecgh committed Nov 10, 2014
1 parent 2656ebf commit 8f1cd24
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
6 changes: 6 additions & 0 deletions rescan.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,12 @@ func (w *Wallet) RescanActiveAddresses() error {
return err
}

// in case there are no addresses, we can skip queuing the rescan job
if len(addrs) == 0 {
close(w.chainSynced)
return nil
}

unspents, err := w.TxStore.UnspentOutputs()
if err != nil {
return err
Expand Down
9 changes: 7 additions & 2 deletions rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -2793,9 +2793,14 @@ func ValidateAddress(w *Wallet, chainSvr *chain.Client, icmd btcjson.Cmd) (inter
result.IsValid = true

ainfo, err := w.Manager.Address(addr)
if managerErr, ok := err.(waddrmgr.ManagerError); ok {
if managerErr.ErrorCode == waddrmgr.ErrAddressNotFound {
// No additional information available about the address.
return result, nil
}
}
if err != nil {
// No additional information available about the address.
return result, nil
return nil, err
}

// The address lookup was successful which means there is further
Expand Down
8 changes: 4 additions & 4 deletions walletsetup.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,11 @@ func promptConsoleSeed(reader *bufio.Reader) ([]byte, error) {

fmt.Println("Your wallet generation seed is:")
fmt.Printf("%x\n", seed)
fmt.Println("IMPORTANT: Keep the seed in a safe place as you " +
fmt.Println("IMPORTANT: Keep the seed in a safe place as you\n" +
"will NOT be able to restore your wallet without it.")
fmt.Println("Please keep in mind that anyone who has access " +
"to the seed can also restore your wallet thereby " +
"giving them access to all your funds, so it is " +
fmt.Println("Please keep in mind that anyone who has access\n" +
"to the seed can also restore your wallet thereby\n" +
"giving them access to all your funds, so it is\n" +
"imperative that you keep it in a secure location.")

for {
Expand Down

0 comments on commit 8f1cd24

Please sign in to comment.