aboutsummaryrefslogtreecommitdiffstats
path: root/ethutil/bytes.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-09-15 21:42:12 +0800
committerobscuren <geffobscura@gmail.com>2014-09-15 21:42:12 +0800
commit33a0dec8a157b9687ca6038f4deb011f3f1f7bdc (patch)
tree197b792e06dc3952df93957a39fdf6e44582ac96 /ethutil/bytes.go
parent2f614900e82036e3e8f6f6a714efc43e09aca830 (diff)
downloaddexon-33a0dec8a157b9687ca6038f4deb011f3f1f7bdc.tar
dexon-33a0dec8a157b9687ca6038f4deb011f3f1f7bdc.tar.gz
dexon-33a0dec8a157b9687ca6038f4deb011f3f1f7bdc.tar.bz2
dexon-33a0dec8a157b9687ca6038f4deb011f3f1f7bdc.tar.lz
dexon-33a0dec8a157b9687ca6038f4deb011f3f1f7bdc.tar.xz
dexon-33a0dec8a157b9687ca6038f4deb011f3f1f7bdc.tar.zst
dexon-33a0dec8a157b9687ca6038f4deb011f3f1f7bdc.zip
Improved catching up and refactored
Diffstat (limited to 'ethutil/bytes.go')
-rw-r--r--ethutil/bytes.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/ethutil/bytes.go b/ethutil/bytes.go
index e38f89454..f151d16ee 100644
--- a/ethutil/bytes.go
+++ b/ethutil/bytes.go
@@ -9,6 +9,22 @@ import (
"strings"
)
+type Bytes []byte
+
+func (self Bytes) String() string {
+ return string(self)
+}
+
+func DeleteFromByteSlice(s [][]byte, hash []byte) [][]byte {
+ for i, h := range s {
+ if bytes.Compare(h, hash) == 0 {
+ return append(s[:i], s[i+1:]...)
+ }
+ }
+
+ return s
+}
+
// Number to bytes
//
// Returns the number in bytes with the specified base