Removed recursive function for loop
This commit is contained in:
parent
474c85bc9d
commit
47a58b40cd
@ -643,12 +643,12 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
function addBlock(block) {
|
||||
var objtt = JSON.parse(block.transactions);
|
||||
var txs = JSON.parse(block.transactions);
|
||||
var amount = 0
|
||||
if(objtt != null){
|
||||
amount = objtt.length
|
||||
if(txs != null){
|
||||
amount = txs.length
|
||||
}
|
||||
blockModel.insert(0, {number: block.number, hash: block.hash, txs: objtt, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)})
|
||||
blockModel.insert(0, {number: block.number, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)})
|
||||
}
|
||||
|
||||
function addLog(str) {
|
||||
|
@ -136,20 +136,13 @@ func (gui *Gui) createWindow(comp qml.Object) *qml.Window {
|
||||
|
||||
return gui.win
|
||||
}
|
||||
func (gui *Gui) recursiveAdd(sBlk []byte) {
|
||||
blk := gui.eth.BlockChain().GetBlock(sBlk)
|
||||
if blk != nil {
|
||||
//ethutil.Config.Log.Infoln("Adding block", blk)
|
||||
gui.processBlock(blk)
|
||||
gui.recursiveAdd(blk.PrevHash)
|
||||
return
|
||||
} else {
|
||||
//ethutil.Config.Log.Debugln("At Genesis, added all blocks to GUI")
|
||||
}
|
||||
return
|
||||
}
|
||||
func (gui *Gui) setInitialBlockChain() {
|
||||
gui.recursiveAdd(gui.eth.BlockChain().LastBlockHash)
|
||||
sBlk := gui.eth.BlockChain().LastBlockHash
|
||||
blk := gui.eth.BlockChain().GetBlock(sBlk)
|
||||
for ; blk != nil; blk = gui.eth.BlockChain().GetBlock(sBlk) {
|
||||
sBlk = blk.PrevHash
|
||||
gui.processBlock(blk)
|
||||
}
|
||||
}
|
||||
|
||||
func (gui *Gui) readPreviousTransactions() {
|
||||
|
Loading…
Reference in New Issue
Block a user