aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-06-16 01:28:48 +0800
committerobscuren <geffobscura@gmail.com>2015-06-16 01:28:48 +0800
commit5daf8729be88eca87b302ebf7a46fc69cad0f6d0 (patch)
tree0053cb5b84978645b3c83895a651c512e081a183 /common
parentbac9a94ddf20dc530966cbf6cd384aaf94aedc77 (diff)
parent4673b04503742de9b1622557b44135d6a4934ad6 (diff)
downloadgo-tangerine-5daf8729be88eca87b302ebf7a46fc69cad0f6d0.tar
go-tangerine-5daf8729be88eca87b302ebf7a46fc69cad0f6d0.tar.gz
go-tangerine-5daf8729be88eca87b302ebf7a46fc69cad0f6d0.tar.bz2
go-tangerine-5daf8729be88eca87b302ebf7a46fc69cad0f6d0.tar.lz
go-tangerine-5daf8729be88eca87b302ebf7a46fc69cad0f6d0.tar.xz
go-tangerine-5daf8729be88eca87b302ebf7a46fc69cad0f6d0.tar.zst
go-tangerine-5daf8729be88eca87b302ebf7a46fc69cad0f6d0.zip
Merge branch 'release/0.9.30'v0.9.30
Diffstat (limited to 'common')
-rw-r--r--common/path.go7
-rw-r--r--common/types.go11
2 files changed, 18 insertions, 0 deletions
diff --git a/common/path.go b/common/path.go
index 3468b3366..6e3259656 100644
--- a/common/path.go
+++ b/common/path.go
@@ -94,6 +94,13 @@ func DefaultDataDir() string {
}
}
+func DefaultIpcPath() string {
+ if runtime.GOOS == "windows" {
+ return `\\.\pipe\geth.ipc`
+ }
+ return filepath.Join(DefaultDataDir(), "geth.ipc")
+}
+
func IsWindows() bool {
return runtime.GOOS == "windows"
}
diff --git a/common/types.go b/common/types.go
index 183d48fb3..d05c21eec 100644
--- a/common/types.go
+++ b/common/types.go
@@ -1,6 +1,7 @@
package common
import (
+ "fmt"
"math/big"
"math/rand"
"reflect"
@@ -95,3 +96,13 @@ func (a *Address) Set(other Address) {
a[i] = v
}
}
+
+// PP Pretty Prints a byte slice in the following format:
+// hex(value[:4])...(hex[len(value)-4:])
+func PP(value []byte) string {
+ if len(value) <= 8 {
+ return Bytes2Hex(value)
+ }
+
+ return fmt.Sprintf("%x...%x", value[:4], value[len(value)-4])
+}