aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-17 00:09:08 +0800
committerobscuren <geffobscura@gmail.com>2015-03-17 00:09:08 +0800
commite620bde405161771ea7ecd1cee8641eb9265465e (patch)
treef41b8f98215a2db7aa59e11ce107724b978f759d /common
parent76f215b0feca1fc56890fe5f9ec1acbed79cb701 (diff)
downloadgo-tangerine-e620bde405161771ea7ecd1cee8641eb9265465e.tar.gz
go-tangerine-e620bde405161771ea7ecd1cee8641eb9265465e.tar.zst
go-tangerine-e620bde405161771ea7ecd1cee8641eb9265465e.zip
conversion state
Diffstat (limited to 'common')
-rw-r--r--common/types.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/common/types.go b/common/types.go
index 8f0e8fd26..3dc4500b3 100644
--- a/common/types.go
+++ b/common/types.go
@@ -1,5 +1,7 @@
package common
+import "fmt"
+
type Hash [32]byte
var (
@@ -31,7 +33,7 @@ func (h Hash) Str() string {
// Sets the hash to the value of b. If b is larger than len(h) it will panic
func (h *Hash) SetBytes(b []byte) {
if len(b) > len(h) {
- panic("unable to set bytes. too big")
+ panic(fmt.Sprintf("unable to set bytes. too big = %d", len(b)))
}
// reverse loop
@@ -60,11 +62,11 @@ func (a Address) Str() string {
// Sets the address to the value of b. If b is larger than len(a) it will panic
func (a *Address) SetBytes(b []byte) {
if len(b) > len(a) {
- panic("unable to set bytes. too big")
+ panic(fmt.Sprintf("unable to set bytes. too big = %d", len(b)))
}
// reverse loop
- for i := len(b); i >= 0; i-- {
+ for i := len(b) - 1; i >= 0; i-- {
a[i] = b[i]
}
}