Fixed using new trie iterator API

This commit is contained in:
obscuren 2015-01-02 12:07:26 +01:00
parent 1cc86c07a0
commit 0972bdeda2
2 changed files with 22 additions and 22 deletions

View File

@ -309,9 +309,11 @@ func (d *Debugger) halting(pc int, op vm.OpCode, mem *vm.Memory, stack *vm.Stack
d.win.Root().Call("setStack", val.String()) d.win.Root().Call("setStack", val.String())
} }
stateObject.EachStorage(func(key string, node *ethutil.Value) { it := stateObject.Trie().Iterator()
d.win.Root().Call("setStorage", storeVal{fmt.Sprintf("% x", key), fmt.Sprintf("% x", node.Str())}) for it.Next() {
}) d.win.Root().Call("setStorage", storeVal{fmt.Sprintf("% x", it.Key), fmt.Sprintf("% x", it.Value)})
}
stackFrameAt := new(big.Int).SetBytes(mem.Get(0, 32)) stackFrameAt := new(big.Int).SetBytes(mem.Get(0, 32))
psize := mem.Len() - int(new(big.Int).SetBytes(mem.Get(0, 32)).Uint64()) psize := mem.Len() - int(new(big.Int).SetBytes(mem.Get(0, 32)).Uint64())

View File

@ -231,35 +231,33 @@ func (gui *Gui) loadAddressBook() {
view := gui.getObjectByName("infoView") view := gui.getObjectByName("infoView")
nameReg := gui.pipe.World().Config().Get("NameReg") nameReg := gui.pipe.World().Config().Get("NameReg")
if nameReg != nil { if nameReg != nil {
nameReg.EachStorage(func(name string, value *ethutil.Value) { it := nameReg.Trie().Iterator()
if name[0] != 0 { for it.Next() {
value.Decode() if it.Key[0] != 0 {
view.Call("addAddress", struct{ Name, Address string }{string(it.Key), ethutil.Bytes2Hex(it.Value)})
view.Call("addAddress", struct{ Name, Address string }{name, ethutil.Bytes2Hex(value.Bytes())})
} }
})
}
} }
} }
func (self *Gui) loadMergedMiningOptions() { func (self *Gui) loadMergedMiningOptions() {
view := self.getObjectByName("mergedMiningModel") view := self.getObjectByName("mergedMiningModel")
nameReg := self.pipe.World().Config().Get("MergeMining") mergeMining := self.pipe.World().Config().Get("MergeMining")
if nameReg != nil { if mergeMining != nil {
i := 0 i := 0
nameReg.EachStorage(func(name string, value *ethutil.Value) { it := mergeMining.Trie().Iterator()
if name[0] != 0 { for it.Next() {
value.Decode() view.Call("addMergedMiningOption", struct {
Checked bool
Name, Address string
Id, ItemId int
}{false, string(it.Key), ethutil.Bytes2Hex(it.Value), 0, i})
view.Call("addMergedMiningOption", struct { i++
Checked bool
Name, Address string
Id, ItemId int
}{false, name, ethutil.Bytes2Hex(value.Bytes()), 0, i})
i++ }
}
})
} }
} }