OSDN Git Service

try to fix ban peer bug (#273)
[bytom/vapor.git] / testutil / hex.go
index 137e0b2..84fbdc9 100644 (file)
@@ -2,6 +2,7 @@ package testutil
 
 import (
        "bytes"
+       "encoding/hex"
        "io"
        "testing"
 
@@ -15,6 +16,14 @@ func MustDecodeHash(s string) (h bc.Hash) {
        return h
 }
 
+func MustDecodeHexString(s string) []byte {
+       bytes, err := hex.DecodeString(s)
+       if err != nil {
+               panic(err)
+       }
+       return bytes
+}
+
 func MustDecodeAsset(s string) (h bc.AssetID) {
        if err := h.UnmarshalText([]byte(s)); err != nil {
                panic(err)