aboutsummaryrefslogtreecommitdiffstats
path: root/common/common.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-03-19 19:17:43 +0800
committerFelix Lange <fjl@twurst.com>2015-03-19 19:17:43 +0800
commite13c6739804604849c7e43d27b073e68fba58191 (patch)
treeb3471931b63210a4d107875dffd6572bcd96239e /common/common.go
parent965c9babe336cfa8d5c740d5356acbc5f9ba4a72 (diff)
parent5f35e6778f10d9e2c6418beff7ed201be80448c4 (diff)
downloadgo-tangerine-e13c6739804604849c7e43d27b073e68fba58191.tar
go-tangerine-e13c6739804604849c7e43d27b073e68fba58191.tar.gz
go-tangerine-e13c6739804604849c7e43d27b073e68fba58191.tar.bz2
go-tangerine-e13c6739804604849c7e43d27b073e68fba58191.tar.lz
go-tangerine-e13c6739804604849c7e43d27b073e68fba58191.tar.xz
go-tangerine-e13c6739804604849c7e43d27b073e68fba58191.tar.zst
go-tangerine-e13c6739804604849c7e43d27b073e68fba58191.zip
Merge remote-tracking branch 'ethereum/conversion' into conversion
Diffstat (limited to 'common/common.go')
-rw-r--r--common/common.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/common/common.go b/common/common.go
index 1371d18d4..155bb5c2a 100644
--- a/common/common.go
+++ b/common/common.go
@@ -65,6 +65,15 @@ func DefaultDataDir() string {
}
}
+func ToHex(b []byte) string {
+ hex := Bytes2Hex(b)
+ // Prefer output of "0x0" instead of "0x"
+ if len(hex) == 0 {
+ hex = "0"
+ }
+ return "0x" + hex
+}
+
func FromHex(s string) []byte {
if len(s) > 1 {
if s[0:2] == "0x" {