Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Marginally clean up acct/addr discovery code. (#383)
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