mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-25 13:07:17 +00:00
Initial block chain fetching of existing blocks
This commit is contained in:
parent
05c353eca0
commit
aaac0c9998
12
ui/gui.go
12
ui/gui.go
@ -53,12 +53,22 @@ func (ui *Gui) Start() {
|
||||
context.SetVar("tester", &Tester{root: root})
|
||||
|
||||
ui.eth.BlockManager.SecondaryBlockProcessor = ui
|
||||
ui.eth.Start()
|
||||
|
||||
go ui.setInitialBlockChain()
|
||||
|
||||
ui.win.Show()
|
||||
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) {
|
||||
ui.win.Root().Call("addBlock", NewBlockFromBlock(block))
|
||||
}
|
||||
|
@ -76,6 +76,6 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
function addBlock(block) {
|
||||
blockModel.append({number: block.number, hash: block.hash})
|
||||
blockModel.insert(0, {number: block.number, hash: block.hash})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user