Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix all bits broken by viper API changes #5982

Merged
merged 8 commits into from
Apr 14, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
client/keys: don't use viper.IsSet()
  • Loading branch information
Alessio Treglia committed Apr 10, 2020
commit a5abc08cf0913e4c9ae92882934cf36e8c763617
10 changes: 3 additions & 7 deletions client/keys/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,20 +190,16 @@ func RunAddCmd(cmd *cobra.Command, args []string, kb keyring.Keyring, inBuf *buf
coinType := uint32(viper.GetInt(flagCoinType))
account := uint32(viper.GetInt(flagAccount))
index := uint32(viper.GetInt(flagIndex))
hdPath := viper.GetString(flagHDPath)

useBIP44 := !viper.IsSet(flagHDPath)
var hdPath string

if useBIP44 {
if len(hdPath) == 0 {
hdPath = hd.CreateHDPath(coinType, account, index).String()
} else {
hdPath = viper.GetString(flagHDPath)
}

// If we're using ledger, only thing we need is the path and the bech32 prefix.
if viper.GetBool(flags.FlagUseLedger) {

if !useBIP44 {
if len(hdPath) != 0 {
return errors.New("cannot set custom bip32 path with ledger")
}

Expand Down