Skip to content

Commit

Permalink
Marginally clean up acct/addr discovery code. (#383)
Browse files Browse the repository at this point in the history
Errors are no longer hidden by returning in-band values.  Explicit
checks have also been added to test for hdkeychain.ErrInvalidChild
rather than assumming that any random error is an invalid BIP0032
child key derivation.

Some vars that didn't need to be were changed to const and moved to
the top of the file.

Use uint32 everywhere for indexes rather than mixing int and uint32
(I'm guessing this was largely thanks to Go's "type inferrence" rules
which default to int).  Removes a lot of unnecessary type conversions
and makes the code a little less cluttered.

Since all of this code requires the consensus server RPC client, just
pass it in as a parameter and pass it around to all of the helper
functions instead of calling Wallet.requireChainClient from most of
them.

Remove late decision making of which address derivation function
to use, replacing this with single check in the entry point function.
Pass a parameter for whether accounts should be synced as well
(requires the wallet to be unlocked).
  • Loading branch information
jrick committed Nov 11, 2016
1 parent 1afdc99 commit 668f78c
Show file tree
Hide file tree
Showing 2 changed files with 165 additions and 156 deletions.
Loading

0 comments on commit 668f78c

Please sign in to comment.