diff options
author | obscuren <geffobscura@gmail.com> | 2014-06-30 19:09:04 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-06-30 19:09:04 +0800 |
commit | 8ddd4c4c52eef9f382a321fa880adba4a1e35ee2 (patch) | |
tree | 0d9940dc0d58bad1a07e5bb41a69c3aedd6b199b /ethutil/value.go | |
parent | 5a86892ecbd68c3d466cb1ef282c4cb81300abce (diff) | |
download | go-tangerine-8ddd4c4c52eef9f382a321fa880adba4a1e35ee2.tar go-tangerine-8ddd4c4c52eef9f382a321fa880adba4a1e35ee2.tar.gz go-tangerine-8ddd4c4c52eef9f382a321fa880adba4a1e35ee2.tar.bz2 go-tangerine-8ddd4c4c52eef9f382a321fa880adba4a1e35ee2.tar.lz go-tangerine-8ddd4c4c52eef9f382a321fa880adba4a1e35ee2.tar.xz go-tangerine-8ddd4c4c52eef9f382a321fa880adba4a1e35ee2.tar.zst go-tangerine-8ddd4c4c52eef9f382a321fa880adba4a1e35ee2.zip |
wip
Diffstat (limited to 'ethutil/value.go')
-rw-r--r-- | ethutil/value.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ethutil/value.go b/ethutil/value.go index ddd864d8a..b37b33c28 100644 --- a/ethutil/value.go +++ b/ethutil/value.go @@ -116,6 +116,8 @@ func (val *Value) Bytes() []byte { return a } else if s, ok := val.Val.(byte); ok { return []byte{s} + } else if s, ok := val.Val.(string); ok { + return []byte(s) } return []byte{} @@ -196,6 +198,12 @@ func (val *Value) Encode() []byte { return Encode(val.Val) } +// Assume that the data we have is encoded +func (self *Value) Decode() { + v, _ := Decode(self.Bytes(), 0) + self.Val = v +} + func NewValueFromBytes(data []byte) *Value { if len(data) != 0 { data, _ := Decode(data, 0) |