Fixup off by one

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2020-10-12 00:50:29 +02:00
parent d6c8276c7a
commit 7b4a5fc7ca
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA

View File

@ -193,16 +193,13 @@ func (lw LedgerWallet) WalletNew(ctx context.Context, t types.KeyType) (address.
maxi = int64(i) maxi = int64(i)
} }
} }
if maxi == -1 {
maxi = 0
}
fl, err := ledgerfil.FindLedgerFilecoinApp() fl, err := ledgerfil.FindLedgerFilecoinApp()
if err != nil { if err != nil {
return address.Undef, xerrors.Errorf("finding ledger: %w", err) return address.Undef, xerrors.Errorf("finding ledger: %w", err)
} }
path := append(append([]uint32(nil), filHDBasePath...), uint32(maxi)) path := append(append([]uint32(nil), filHDBasePath...), uint32(maxi+1))
_, _, addr, err := fl.GetAddressPubKeySECP256K1(path) _, _, addr, err := fl.GetAddressPubKeySECP256K1(path)
if err != nil { if err != nil {
return address.Undef, xerrors.Errorf("getting public key from ledger: %w", err) return address.Undef, xerrors.Errorf("getting public key from ledger: %w", err)