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
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user