Revert Address() scheme change
This commit is contained in:
parent
9a95e7b7a5
commit
8152c18c35
10
pub_key.go
10
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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue