mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-18 05:44:43 +00:00
a67728628e
* Created test_data folder with block json files for testing + create separate file for block base. * Fixed bug in WriteVarUint + Trim logic + unit tests * Refactored store and add more tests for it. * restore headerList from chain file * Fix tx decode bug + lots of housekeeping. * Implemented Node restore state from chain file. * Created standalone package for storage. Added couple more methods to Batch and Store interfaces. * Block persisting + tests * bumped version -> 0.31.0
23 lines
594 B
Go
23 lines
594 B
Go
package crypto
|
|
|
|
import (
|
|
"github.com/CityOfZion/neo-go/pkg/util"
|
|
)
|
|
|
|
// AddressFromUint160 returns the "NEO address" from the given
|
|
// Uint160.
|
|
func AddressFromUint160(u util.Uint160) string {
|
|
// Dont forget to prepend the Address version 0x17 (23) A
|
|
b := append([]byte{0x17}, u.Bytes()...)
|
|
return Base58CheckEncode(b)
|
|
}
|
|
|
|
// Uint160DecodeAddress attempts to decode the given NEO address string
|
|
// into an Uint160.
|
|
func Uint160DecodeAddress(s string) (u util.Uint160, err error) {
|
|
b, err := Base58CheckDecode(s)
|
|
if err != nil {
|
|
return u, err
|
|
}
|
|
return util.Uint160DecodeBytes(b[1:21])
|
|
}
|