aboutsummaryrefslogtreecommitdiffstats
path: root/common/types.go
diff options
context:
space:
mode:
Diffstat (limited to 'common/types.go')
-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]
}
}