aboutsummaryrefslogtreecommitdiffstats
path: root/ethutil/value.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-02-17 03:30:33 +0800
committerobscuren <geffobscura@gmail.com>2014-02-17 03:30:33 +0800
commitc95a27e39485eeeebd8608537115a4fd246c246c (patch)
tree96545c7ff18382da5c672fcc496e95f7da1864ea /ethutil/value.go
parent066940f134170ab4b0901887b69f824418c322fc (diff)
downloadgo-tangerine-c95a27e39485eeeebd8608537115a4fd246c246c.tar
go-tangerine-c95a27e39485eeeebd8608537115a4fd246c246c.tar.gz
go-tangerine-c95a27e39485eeeebd8608537115a4fd246c246c.tar.bz2
go-tangerine-c95a27e39485eeeebd8608537115a4fd246c246c.tar.lz
go-tangerine-c95a27e39485eeeebd8608537115a4fd246c246c.tar.xz
go-tangerine-c95a27e39485eeeebd8608537115a4fd246c246c.tar.zst
go-tangerine-c95a27e39485eeeebd8608537115a4fd246c246c.zip
Added more tests
Diffstat (limited to 'ethutil/value.go')
-rw-r--r--ethutil/value.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/ethutil/value.go b/ethutil/value.go
index f91c33983..701ece5bb 100644
--- a/ethutil/value.go
+++ b/ethutil/value.go
@@ -84,6 +84,8 @@ func (val *Value) BigInt() *big.Int {
b := new(big.Int).SetBytes(a)
return b
+ } else if a, ok := val.Val.(*big.Int); ok {
+ return a
} else {
return big.NewInt(int64(val.Uint()))
}
@@ -106,7 +108,7 @@ func (val *Value) Bytes() []byte {
return a
}
- return make([]byte, 0)
+ return []byte{}
}
func (val *Value) Slice() []interface{} {
@@ -144,7 +146,7 @@ func (val *Value) Get(idx int) *Value {
}
if idx < 0 {
- panic("negative idx for Rlp Get")
+ panic("negative idx for Value Get")
}
return NewValue(d[idx])
@@ -162,9 +164,9 @@ func (val *Value) Encode() []byte {
return Encode(val.Val)
}
-func NewValueFromBytes(rlpData []byte) *Value {
- if len(rlpData) != 0 {
- data, _ := Decode(rlpData, 0)
+func NewValueFromBytes(data []byte) *Value {
+ if len(data) != 0 {
+ data, _ := Decode(data, 0)
return NewValue(data)
}