From 61fdd5cde5de586b185f5e8937f5138b92d88d03 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 12 Nov 2019 12:58:11 +0300 Subject: [PATCH] util: make Uint256Size public --- pkg/util/uint256.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/util/uint256.go b/pkg/util/uint256.go index 4de10b135..40dfdb93a 100644 --- a/pkg/util/uint256.go +++ b/pkg/util/uint256.go @@ -8,15 +8,16 @@ import ( "strings" ) -const uint256Size = 32 +// Uint256Size is the size of Uint256 in bytes. +const Uint256Size = 32 // Uint256 is a 32 byte long unsigned integer. -type Uint256 [uint256Size]uint8 +type Uint256 [Uint256Size]uint8 // Uint256DecodeReverseString attempts to decode the given string (in LE representation) into an Uint256. func Uint256DecodeReverseString(s string) (u Uint256, err error) { - if len(s) != uint256Size*2 { - return u, fmt.Errorf("expected string size of %d got %d", uint256Size*2, len(s)) + if len(s) != Uint256Size*2 { + return u, fmt.Errorf("expected string size of %d got %d", Uint256Size*2, len(s)) } b, err := hex.DecodeString(s) if err != nil { @@ -27,8 +28,8 @@ func Uint256DecodeReverseString(s string) (u Uint256, err error) { // 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)) + if len(b) != Uint256Size { + return u, fmt.Errorf("expected []byte of size %d got %d", Uint256Size, len(b)) } copy(u[:], b) return u, nil