Browse Source

Cleanup nano calls, cannot run parallel test on one hardware device

pull/1782/head
Ethan Frey 7 years ago
parent
commit
085d72d212
4 changed files with 4 additions and 3 deletions
  1. +1
    -1
      Makefile
  2. +1
    -0
      keys/cryptostore/holder_test.go
  3. +2
    -0
      nano/keys.go
  4. +0
    -2
      nano/sign.go

+ 1
- 1
Makefile View File

@ -10,7 +10,7 @@ REPO:=github.com/tendermint/go-crypto
all: get_vendor_deps metalinter_test test all: get_vendor_deps metalinter_test test
test: test:
go test `glide novendor`
go test -p 1 `glide novendor`
get_vendor_deps: ensure_tools get_vendor_deps: ensure_tools
@rm -rf vendor/ @rm -rf vendor/


+ 1
- 0
keys/cryptostore/holder_test.go View File

@ -185,6 +185,7 @@ func TestSignWithLedger(t *testing.T) {
assert.Equal(info.Name, n) assert.Equal(info.Name, n)
key := info.PubKey key := info.PubKey
require.False(key.Empty()) require.False(key.Empty())
require.True(key.Equals(c.PubKey))
// let's try to sign some messages // let's try to sign some messages
d1 := []byte("welcome to cosmos") d1 := []byte("welcome to cosmos")


+ 2
- 0
nano/keys.go View File

@ -92,6 +92,8 @@ func (pk *PrivKeyLedger) Sign(msg []byte) crypto.Signature {
// if we have no pubkey yet, store it for future queries // if we have no pubkey yet, store it for future queries
if pk.CachedPubKey.Empty() { if pk.CachedPubKey.Empty() {
pk.CachedPubKey = pub pk.CachedPubKey = pub
} else if !pk.CachedPubKey.Equals(pub) {
panic("signed with a different key than stored")
} }
return sig return sig
} }


+ 0
- 2
nano/sign.go View File

@ -3,7 +3,6 @@ package nano
import ( import (
"bytes" "bytes"
"crypto/sha512" "crypto/sha512"
"fmt"
"github.com/pkg/errors" "github.com/pkg/errors"
@ -55,7 +54,6 @@ func parseDigest(resp []byte) (key, sig []byte, err error) {
if !bytes.Equal(separator, resp[:len(separator)]) { if !bytes.Equal(separator, resp[:len(separator)]) {
return nil, nil, errors.New("Cannot find 0xCAFE") return nil, nil, errors.New("Cannot find 0xCAFE")
} }
fmt.Println("successs")
sig = resp[len(separator):] sig = resp[len(separator):]
return key, sig, nil return key, sig, nil


Loading…
Cancel
Save