Browse Source

Update to latest upstream, debugging information

pull/1782/head
Christopher Goes 7 years ago
parent
commit
e6d0ade0e1
2 changed files with 8 additions and 6 deletions
  1. +3
    -3
      Gopkg.lock
  2. +5
    -3
      ledger.go

+ 3
- 3
Gopkg.lock View File

@ -119,7 +119,7 @@
"leveldb/table", "leveldb/table",
"leveldb/util" "leveldb/util"
] ]
revision = "ae970a0732be3a1f5311da86118d37b9f4bd2a5a"
revision = "9637fa0b2f0db13c99d899b91007edb7df4610b7"
[[projects]] [[projects]]
branch = "master" branch = "master"
@ -157,7 +157,7 @@
branch = "master" branch = "master"
name = "github.com/zondax/ledger-goclient" name = "github.com/zondax/ledger-goclient"
packages = ["."] packages = ["."]
revision = "a242cfad962597a588288f99fa3425a01a820295"
revision = "5b2fe84d3139027c29bd8f0c054ed9444f8a7622"
[[projects]] [[projects]]
branch = "master" branch = "master"
@ -173,7 +173,7 @@
"ripemd160", "ripemd160",
"salsa20/salsa" "salsa20/salsa"
] ]
revision = "2d027ae1dddd4694d54f7a8b6cbe78dca8720226"
revision = "034e5325b6ab92faa14d15c30e86919e911cf8e0"
[solve-meta] [solve-meta]
analyzer-name = "dep" analyzer-name = "dep"


+ 5
- 3
ledger.go View File

@ -1,6 +1,7 @@
package crypto package crypto
import ( import (
"fmt"
"github.com/pkg/errors" "github.com/pkg/errors"
secp256k1 "github.com/btcsuite/btcd/btcec" secp256k1 "github.com/btcsuite/btcd/btcec"
@ -23,7 +24,7 @@ func getLedger() (*ledger.Ledger, error) {
func pubkeyLedger(device *ledger.Ledger, path DerivationPath) (pub PubKey, err error) { func pubkeyLedger(device *ledger.Ledger, path DerivationPath) (pub PubKey, err error) {
key, err := device.GetPublicKeySECP256K1(path) key, err := device.GetPublicKeySECP256K1(path)
if err != nil { if err != nil {
return pub, err
return pub, fmt.Errorf("Error fetching public key: %v", err)
} }
var p PubKeySecp256k1 var p PubKeySecp256k1
// Reserialize in the 33-byte compressed format // Reserialize in the 33-byte compressed format
@ -55,6 +56,7 @@ type PrivKeyLedgerSecp256k1 struct {
// public key for later use. // public key for later use.
func NewPrivKeyLedgerSecp256k1(path DerivationPath) (PrivKey, error) { func NewPrivKeyLedgerSecp256k1(path DerivationPath) (PrivKey, error) {
var pk PrivKeyLedgerSecp256k1 var pk PrivKeyLedgerSecp256k1
pk.Path = path
// getPubKey will cache the pubkey for later use, // getPubKey will cache the pubkey for later use,
// this allows us to return an error early if the ledger // this allows us to return an error early if the ledger
// is not plugged in // is not plugged in
@ -150,11 +152,11 @@ func (pk PrivKeyLedgerSecp256k1) getPubKey() (key PubKey, err error) {
func (pk PrivKeyLedgerSecp256k1) forceGetPubKey() (key PubKey, err error) { func (pk PrivKeyLedgerSecp256k1) forceGetPubKey() (key PubKey, err error) {
dev, err := getLedger() dev, err := getLedger()
if err != nil { if err != nil {
return key, errors.New("Cannot connect to Ledger device")
return key, errors.New(fmt.Sprintf("Cannot connect to Ledger device - error: %v", err))
} }
key, err = pubkeyLedger(dev, pk.Path) key, err = pubkeyLedger(dev, pk.Path)
if err != nil { if err != nil {
return key, errors.New("Please open Cosmos app on the Ledger device")
return key, errors.New(fmt.Sprintf("Please open Cosmos app on the Ledger device - error: %v", err))
} }
return key, err return key, err
} }


Loading…
Cancel
Save