From e6d0ade0e1a8315613e026fe64b006f24f58beab Mon Sep 17 00:00:00 2001 From: Christopher Goes Date: Mon, 14 May 2018 15:33:10 +0200 Subject: [PATCH] Update to latest upstream, debugging information --- Gopkg.lock | 6 +++--- ledger.go | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 3e44587e1..d65f87b68 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -119,7 +119,7 @@ "leveldb/table", "leveldb/util" ] - revision = "ae970a0732be3a1f5311da86118d37b9f4bd2a5a" + revision = "9637fa0b2f0db13c99d899b91007edb7df4610b7" [[projects]] branch = "master" @@ -157,7 +157,7 @@ branch = "master" name = "github.com/zondax/ledger-goclient" packages = ["."] - revision = "a242cfad962597a588288f99fa3425a01a820295" + revision = "5b2fe84d3139027c29bd8f0c054ed9444f8a7622" [[projects]] branch = "master" @@ -173,7 +173,7 @@ "ripemd160", "salsa20/salsa" ] - revision = "2d027ae1dddd4694d54f7a8b6cbe78dca8720226" + revision = "034e5325b6ab92faa14d15c30e86919e911cf8e0" [solve-meta] analyzer-name = "dep" diff --git a/ledger.go b/ledger.go index d44b2dab9..a9bc1d975 100644 --- a/ledger.go +++ b/ledger.go @@ -1,6 +1,7 @@ package crypto import ( + "fmt" "github.com/pkg/errors" 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) { key, err := device.GetPublicKeySECP256K1(path) if err != nil { - return pub, err + return pub, fmt.Errorf("Error fetching public key: %v", err) } var p PubKeySecp256k1 // Reserialize in the 33-byte compressed format @@ -55,6 +56,7 @@ type PrivKeyLedgerSecp256k1 struct { // public key for later use. func NewPrivKeyLedgerSecp256k1(path DerivationPath) (PrivKey, error) { var pk PrivKeyLedgerSecp256k1 + pk.Path = path // getPubKey will cache the pubkey for later use, // this allows us to return an error early if the ledger // is not plugged in @@ -150,11 +152,11 @@ func (pk PrivKeyLedgerSecp256k1) getPubKey() (key PubKey, err error) { func (pk PrivKeyLedgerSecp256k1) forceGetPubKey() (key PubKey, err error) { dev, err := getLedger() 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) 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 }