Revert Address() scheme change

This commit is contained in:
Jae Kwon 2016-03-15 15:58:43 -07:00
parent 9a95e7b7a5
commit 8152c18c35
1 changed files with 8 additions and 2 deletions

View File

@ -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)
}