Skip to content

Commit

Permalink
more consistent top block retrieval for UI Armory. Slight change to p…
Browse files Browse the repository at this point in the history
…rogress bars when extending address pool
  • Loading branch information
goatpig committed Mar 11, 2014
1 parent a4ea625 commit 6db524b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 2 additions & 0 deletions ArmoryQt.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ def openMsgSigning():

haveGUI[0] = True
haveGUI[1] = self
BDMcurrentBlock[1] = 1

self.checkWallets()
reactor.callLater(0.1, self.execIntroDialog)
Expand Down Expand Up @@ -4734,6 +4735,7 @@ def Heartbeat(self, nextBeatSec=1):
self.checkSatoshiVersion() # this actually only checks every hour
newBlocks = TheBDM.readBlkFileUpdate(wait=True)
self.currBlockNum = TheBDM.getTopBlockHeight()
if isinstance(self.currBlockNum, int): BDMcurrentBlock[0] = self.currBlockNum

if not newBlocks:
newBlocks = 0
Expand Down
5 changes: 4 additions & 1 deletion armoryengine/BDM.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
from armoryengine.Timer import TimeThisFunction
import CppBlockUtils as Cpp

BDMcurrentBlock = [UINT32_MAX, 0]


def getCurrTimeAndBlock():
time0 = long(RightNowUTC())
if TheBDM.getBDMState()=='BlockchainReady':
return (time0, TheBDM.getTopBlockHeight())
if BDMcurrentBlock[1]: return (time0, BDMcurrentBlock[0])
else: return (time0, TheBDM.getTopBlockHeight())
else:
return (time0, UINT32_MAX)

Expand Down
11 changes: 7 additions & 4 deletions armoryengine/PyBtcWallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,10 +948,13 @@ def fillAddressPool(self, numPool=None, isActuallyNew=True, doRegister=True, GUI
gap = self.lastComputedChainIndex - self.highestUsedChainIndex
numToCreate = max(numPool - gap, 0)

from qtdialogs import DlgProgress
dlgprg = DlgProgress(self.mainWnd, self.mainWnd, HBar=numToCreate, Title='Computing New Addresses')
dlgprg.exec_(self.fillAddressPool_(numPool, isActuallyNew, doRegister, dlgprg, async=dlgprg.Kill))
return self.lastComputedChainIndex
if numToCreate > 1:
from qtdialogs import DlgProgress
dlgprg = DlgProgress(self.mainWnd, self.mainWnd, HBar=numToCreate, Title='Computing New Addresses')
dlgprg.exec_(self.fillAddressPool_(numPool, isActuallyNew, doRegister, dlgprg, async=dlgprg.Kill))
return self.lastComputedChainIndex
else:
return self.fillAddressPool_(numPool, isActuallyNew, doRegister)

#############################################################################
@AllowAsync
Expand Down

0 comments on commit 6db524b

Please sign in to comment.