interop: refactor address.FromHash160 code

Make it more simple.
This commit is contained in:
Anna Shaleva 2022-09-27 13:41:41 +03:00
parent 5d578fdd95
commit 24c107e3a2

View file

@ -29,8 +29,6 @@ func FromHash160(hash interop.Hash160) string {
if len(hash) != interop.Hash160Len { if len(hash) != interop.Hash160Len {
panic("invalid Hash160 length") panic("invalid Hash160 length")
} }
var res = make([]byte, interop.Hash160Len+1) res := append([]byte{byte(runtime.GetAddressVersion())}, hash...)
res[0] = byte(runtime.GetAddressVersion())
copy(res[1:], hash) // @fixme #2696
return std.Base58CheckEncode(res) return std.Base58CheckEncode(res)
} }