diff --git a/.travis.yml b/.travis.yml index 00c7e88..84756a1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ language: go sudo: false go: - - 1.9.x + - 1.11.x install: - make deps diff --git a/peer.go b/peer.go index 90b26ec..5becf8f 100644 --- a/peer.go +++ b/peer.go @@ -11,15 +11,6 @@ import ( mh "github.com/multiformats/go-multihash" ) -// MaxInlineKeyLength is the maximum length a key can be for it to be inlined in -// the peer ID. -// -// * When `len(pubKey.Bytes()) <= MaxInlineKeyLength`, the peer ID is the -// identity multihash hash of the public key. -// * When `len(pubKey.Bytes()) > MaxInlineKeyLength`, the peer ID is the -// sha2-256 multihash of the public key. -const MaxInlineKeyLength = 42 - var ( // ErrEmptyPeerID is an error for empty peer ID. ErrEmptyPeerID = errors.New("empty peer ID") @@ -150,11 +141,7 @@ func IDFromPublicKey(pk ic.PubKey) (ID, error) { if err != nil { return "", err } - var alg uint64 = mh.SHA2_256 - if len(b) <= MaxInlineKeyLength { - alg = mh.ID - } - hash, _ := mh.Sum(b, alg, -1) + hash, _ := mh.Sum(b, mh.SHA2_256, -1) return ID(hash), nil } diff --git a/peer_test.go b/peer_test.go index a410869..2f0cb91 100644 --- a/peer_test.go +++ b/peer_test.go @@ -154,6 +154,7 @@ func TestIDMatchesPrivateKey(t *testing.T) { } func TestPublicKeyExtraction(t *testing.T) { + t.Skip("disabled until libp2p/go-libp2p-crypto#51 is fixed") // Happy path _, originalPub, err := ic.GenerateEd25519Key(rand.Reader) if err != nil {