From cc1d043423293eff97d01c8f4897b354112c8210 Mon Sep 17 00:00:00 2001 From: Maran Date: Tue, 3 Jun 2014 11:48:44 +0200 Subject: [PATCH] Implemented transaction catching up. Implements #73 --- ethereal/ui/gui.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ethereal/ui/gui.go b/ethereal/ui/gui.go index db06add8ef..701bacf000 100644 --- a/ethereal/ui/gui.go +++ b/ethereal/ui/gui.go @@ -163,6 +163,17 @@ func (gui *Gui) setInitialBlockChain() { blk := gui.eth.BlockChain().GetBlock(sBlk) for ; blk != nil; blk = gui.eth.BlockChain().GetBlock(sBlk) { sBlk = blk.PrevHash + + // Loop through all transactions to see if we missed any while being offline + for _, tx := range blk.Transactions() { + if bytes.Compare(tx.Sender(), gui.addr) == 0 || bytes.Compare(tx.Recipient, gui.addr) == 0 { + if ok, _ := gui.txDb.Get(tx.Hash()); ok == nil { + gui.txDb.Put(tx.Hash(), tx.RlpEncode()) + } + + } + } + gui.processBlock(blk, true) } }