diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-15 22:25:09 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-15 22:25:09 +0800 |
commit | d2e75cc957b6f617fe17459dcaff90acf19762a1 (patch) | |
tree | dc01110f74d55192e0c677686a1ac57547950e2e | |
parent | c87cc59bdf0e54318f1d4f013d9d6931422053e3 (diff) | |
download | go-tangerine-d2e75cc957b6f617fe17459dcaff90acf19762a1.tar.gz go-tangerine-d2e75cc957b6f617fe17459dcaff90acf19762a1.tar.zst go-tangerine-d2e75cc957b6f617fe17459dcaff90acf19762a1.zip |
cleaning up unused code
-rw-r--r-- | ethutil/rand.go | 24 | ||||
-rw-r--r-- | ethutil/rand_test.go | 17 | ||||
-rw-r--r-- | ethutil/script_unix.go | 19 | ||||
-rw-r--r-- | ethutil/script_windows.go | 12 | ||||
-rw-r--r-- | ethutil/set.go | 36 |
5 files changed, 0 insertions, 108 deletions
diff --git a/ethutil/rand.go b/ethutil/rand.go deleted file mode 100644 index 91dafec7e..000000000 --- a/ethutil/rand.go +++ /dev/null @@ -1,24 +0,0 @@ -package ethutil - -import ( - "crypto/rand" - "encoding/binary" - "io" -) - -func randomUint64(r io.Reader) (uint64, error) { - b := make([]byte, 8) - n, err := r.Read(b) - if n != len(b) { - return 0, io.ErrShortBuffer - } - if err != nil { - return 0, err - } - return binary.BigEndian.Uint64(b), nil -} - -// RandomUint64 returns a cryptographically random uint64 value. -func RandomUint64() (uint64, error) { - return randomUint64(rand.Reader) -} diff --git a/ethutil/rand_test.go b/ethutil/rand_test.go deleted file mode 100644 index c12698538..000000000 --- a/ethutil/rand_test.go +++ /dev/null @@ -1,17 +0,0 @@ -package ethutil - -import ( - checker "gopkg.in/check.v1" -) - -type RandomSuite struct{} - -var _ = checker.Suite(&RandomSuite{}) - -func (s *RandomSuite) TestRandomUint64(c *checker.C) { - res1, _ := RandomUint64() - res2, _ := RandomUint64() - c.Assert(res1, checker.NotNil) - c.Assert(res2, checker.NotNil) - c.Assert(res1, checker.Not(checker.Equals), res2) -} diff --git a/ethutil/script_unix.go b/ethutil/script_unix.go deleted file mode 100644 index 9250dda57..000000000 --- a/ethutil/script_unix.go +++ /dev/null @@ -1,19 +0,0 @@ -// +build !windows - -package ethutil - -import "github.com/ethereum/serpent-go" - -// General compile function -func Compile(script string, silent bool) (ret []byte, err error) { - if len(script) > 2 { - byteCode, err := serpent.Compile(script) - if err != nil { - return nil, err - } - - return byteCode, nil - } - - return nil, nil -} diff --git a/ethutil/script_windows.go b/ethutil/script_windows.go deleted file mode 100644 index 1dedc5f60..000000000 --- a/ethutil/script_windows.go +++ /dev/null @@ -1,12 +0,0 @@ -// +build windows - -package ethutil - -// General compile function -func Compile(script string, silent bool) (ret []byte, err error) { - if len(script) > 2 { - return nil, nil - } - - return nil, nil -} diff --git a/ethutil/set.go b/ethutil/set.go deleted file mode 100644 index 7955edac0..000000000 --- a/ethutil/set.go +++ /dev/null @@ -1,36 +0,0 @@ -package ethutil - -type Settable interface { - AsSet() UniqueSet -} - -type Stringable interface { - String() string -} - -type UniqueSet map[string]struct{} - -func NewSet(v ...Stringable) UniqueSet { - set := make(UniqueSet) - for _, val := range v { - set.Insert(val) - } - - return set -} - -func (self UniqueSet) Insert(k Stringable) UniqueSet { - self[k.String()] = struct{}{} - - return self -} - -func (self UniqueSet) Include(k Stringable) bool { - _, ok := self[k.String()] - - return ok -} - -func Set(s Settable) UniqueSet { - return s.AsSet() -} |