good morning!!!!

Skip to content
Snippets Groups Projects
Commit aaac0c99 authored by Jeffrey Wilcke's avatar Jeffrey Wilcke
Browse files

Initial block chain fetching of existing blocks

parent 05c353ec
No related branches found
No related tags found
No related merge requests found
...@@ -53,12 +53,22 @@ func (ui *Gui) Start() { ...@@ -53,12 +53,22 @@ func (ui *Gui) Start() {
context.SetVar("tester", &Tester{root: root}) context.SetVar("tester", &Tester{root: root})
ui.eth.BlockManager.SecondaryBlockProcessor = ui ui.eth.BlockManager.SecondaryBlockProcessor = ui
ui.eth.Start()
go ui.setInitialBlockChain()
ui.win.Show() ui.win.Show()
ui.win.Wait() ui.win.Wait()
} }
func (ui *Gui) setInitialBlockChain() {
chain := ui.eth.BlockManager.BlockChain().GetChain(ui.eth.BlockManager.BlockChain().CurrentBlock.Hash(), 10)
for _, block := range chain {
ui.ProcessBlock(block)
}
ui.eth.Start()
}
func (ui *Gui) ProcessBlock(block *ethchain.Block) { func (ui *Gui) ProcessBlock(block *ethchain.Block) {
ui.win.Root().Call("addBlock", NewBlockFromBlock(block)) ui.win.Root().Call("addBlock", NewBlockFromBlock(block))
} }
......
...@@ -76,6 +76,6 @@ ApplicationWindow { ...@@ -76,6 +76,6 @@ ApplicationWindow {
} }
function addBlock(block) { function addBlock(block) {
blockModel.append({number: block.number, hash: block.hash}) blockModel.insert(0, {number: block.number, hash: block.hash})
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment