forked from TrueCloudLab/neoneo-go
hask: import package from _pkg.dev, make it compile
This commit is contained in:
parent
37be2e215c
commit
5c5878968b
3 changed files with 10 additions and 5 deletions
|
@ -4,7 +4,7 @@ import (
|
|||
"crypto/sha256"
|
||||
"io"
|
||||
|
||||
"github.com/CityOfZion/neo-go/pkg/wire/util"
|
||||
"github.com/CityOfZion/neo-go/pkg/util"
|
||||
"golang.org/x/crypto/ripemd160"
|
||||
)
|
||||
|
|
@ -15,7 +15,7 @@ func TestSha256(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
expected := "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"
|
||||
actual := hex.EncodeToString(data.Bytes()) // MARK: In the DecodeBytes function, there is a bytes reverse, not sure why?
|
||||
actual := hex.EncodeToString(data.Bytes())
|
||||
|
||||
assert.Equal(t, expected, actual)
|
||||
}
|
|
@ -25,9 +25,8 @@ func Uint256DecodeReverseString(s string) (u Uint256, err error) {
|
|||
return Uint256DecodeReverseBytes(b)
|
||||
}
|
||||
|
||||
// Uint256DecodeReverseBytes attempts to decode the given string (in LE representation) into an Uint256.
|
||||
func Uint256DecodeReverseBytes(b []byte) (u Uint256, err error) {
|
||||
b = ArrayReverse(b)
|
||||
// Uint256DecodeBytes attempts to decode the given string (in BE representation) into an Uint256.
|
||||
func Uint256DecodeBytes(b []byte) (u Uint256, err error) {
|
||||
if len(b) != uint256Size {
|
||||
return u, fmt.Errorf("expected []byte of size %d got %d", uint256Size, len(b))
|
||||
}
|
||||
|
@ -35,6 +34,12 @@ func Uint256DecodeReverseBytes(b []byte) (u Uint256, err error) {
|
|||
return u, nil
|
||||
}
|
||||
|
||||
// Uint256DecodeReverseBytes attempts to decode the given string (in LE representation) into an Uint256.
|
||||
func Uint256DecodeReverseBytes(b []byte) (u Uint256, err error) {
|
||||
b = ArrayReverse(b)
|
||||
return Uint256DecodeBytes(b)
|
||||
}
|
||||
|
||||
// Bytes returns a byte slice representation of u.
|
||||
func (u Uint256) Bytes() []byte {
|
||||
return u[:]
|
||||
|
|
Loading…
Reference in a new issue