diff options
author | obscuren <geffobscura@gmail.com> | 2014-02-19 18:35:17 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-02-19 18:35:17 +0800 |
commit | 24f2b2afc3a848190822c382e6aa31c8ab120f07 (patch) | |
tree | 827603f276bbcba1240f7f6760df48a0349f0286 /ethutil | |
parent | c866fcc5b37b53e0d11c1fd7e6cb971859537f2c (diff) | |
download | dexon-24f2b2afc3a848190822c382e6aa31c8ab120f07.tar.gz dexon-24f2b2afc3a848190822c382e6aa31c8ab120f07.tar.zst dexon-24f2b2afc3a848190822c382e6aa31c8ab120f07.zip |
Running contracts fixed
Diffstat (limited to 'ethutil')
-rw-r--r-- | ethutil/big.go | 6 | ||||
-rw-r--r-- | ethutil/config.go | 14 | ||||
-rw-r--r-- | ethutil/trie.go | 4 |
3 files changed, 18 insertions, 6 deletions
diff --git a/ethutil/big.go b/ethutil/big.go index 979078bef..c41d63add 100644 --- a/ethutil/big.go +++ b/ethutil/big.go @@ -35,3 +35,9 @@ func BigD(data []byte) *big.Int { return n } + +func BigToBytes(num *big.Int, base int) []byte { + ret := make([]byte, base/8) + + return append(ret[:len(ret)-len(num.Bytes())], num.Bytes()...) +} diff --git a/ethutil/config.go b/ethutil/config.go index df1772d81..70553fb5b 100644 --- a/ethutil/config.go +++ b/ethutil/config.go @@ -34,12 +34,14 @@ func ReadConfig(base string) *config { usr, _ := user.Current() path := path.Join(usr.HomeDir, base) - //Check if the logging directory already exists, create it if not - _, err := os.Stat(path) - if err != nil { - if os.IsNotExist(err) { - log.Printf("Debug logging directory %s doesn't exist, creating it", path) - os.Mkdir(path, 0777) + if len(base) > 0 { + //Check if the logging directory already exists, create it if not + _, err := os.Stat(path) + if err != nil { + if os.IsNotExist(err) { + log.Printf("Debug logging directory %s doesn't exist, creating it", path) + os.Mkdir(path, 0777) + } } } diff --git a/ethutil/trie.go b/ethutil/trie.go index 95abca602..c25bd80cb 100644 --- a/ethutil/trie.go +++ b/ethutil/trie.go @@ -119,6 +119,10 @@ func (t *Trie) Undo() { t.Root = t.prevRoot } +func (t *Trie) Cache() *Cache { + return t.cache +} + /* * Public (query) interface functions */ |