aboutsummaryrefslogtreecommitdiffstats
path: root/ethutil/value.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-03-05 17:42:51 +0800
committerobscuren <geffobscura@gmail.com>2014-03-05 17:42:51 +0800
commit92f2abdf769f52ea8e5e6d02bf326744e926f5b4 (patch)
tree234bcf5278e6804736f7392095733ef133e7fe03 /ethutil/value.go
parent5b1613d65b0c3471b80990120022b5a745ecab86 (diff)
downloadgo-tangerine-92f2abdf769f52ea8e5e6d02bf326744e926f5b4.tar
go-tangerine-92f2abdf769f52ea8e5e6d02bf326744e926f5b4.tar.gz
go-tangerine-92f2abdf769f52ea8e5e6d02bf326744e926f5b4.tar.bz2
go-tangerine-92f2abdf769f52ea8e5e6d02bf326744e926f5b4.tar.lz
go-tangerine-92f2abdf769f52ea8e5e6d02bf326744e926f5b4.tar.xz
go-tangerine-92f2abdf769f52ea8e5e6d02bf326744e926f5b4.tar.zst
go-tangerine-92f2abdf769f52ea8e5e6d02bf326744e926f5b4.zip
Partially refactored server/txpool/block manager/block chain
The Ethereum structure now complies to a EthManager interface which is being used by the tx pool, block manager and block chain in order to gain access to each other. It's become simpeler. TODO: BlockManager => StateManager
Diffstat (limited to 'ethutil/value.go')
-rw-r--r--ethutil/value.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/ethutil/value.go b/ethutil/value.go
index 3dd84d12d..46681ec2a 100644
--- a/ethutil/value.go
+++ b/ethutil/value.go
@@ -224,3 +224,32 @@ func (val *Value) Append(v interface{}) *Value {
return val
}
+
+type ValueIterator struct {
+ value *Value
+ currentValue *Value
+ idx int
+}
+
+func (val *Value) NewIterator() *ValueIterator {
+ return &ValueIterator{value: val}
+}
+
+func (it *ValueIterator) Next() bool {
+ if it.idx >= it.value.Len() {
+ return false
+ }
+
+ it.currentValue = it.value.Get(it.idx)
+ it.idx++
+
+ return true
+}
+
+func (it *ValueIterator) Value() *Value {
+ return it.currentValue
+}
+
+func (it *ValueIterator) Idx() int {
+ return it.idx
+}