From 8152c18c355bb17e38292d9473e71d7998a72a43 Mon Sep 17 00:00:00 2001 From: Jae Kwon Date: Tue, 15 Mar 2016 15:58:43 -0700 Subject: [PATCH] Revert Address() scheme change --- pub_key.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pub_key.go b/pub_key.go index b9500741e..6da13077f 100644 --- a/pub_key.go +++ b/pub_key.go @@ -41,9 +41,15 @@ func PubKeyFromBytes(pubKeyBytes []byte) (pubKey PubKey, err error) { type PubKeyEd25519 [32]byte func (pubKey PubKeyEd25519) Address() []byte { - pubKeyBytes := pubKey.Bytes() + w, n, err := new(bytes.Buffer), new(int), new(error) + wire.WriteBinary(pubKey[:], w, n, err) + if *err != nil { + PanicCrisis(*err) + } + // append type byte + encodedPubkey := append([]byte{1}, w.Bytes()...) hasher := ripemd160.New() - hasher.Write(pubKeyBytes) // does not error + hasher.Write(encodedPubkey) // does not error return hasher.Sum(nil) }