Skip to content

Commit

Permalink
Print initial scanning status every 15 seconds
Browse files Browse the repository at this point in the history
The initial transaction scanning can easily take several minutes, maybe longer, and the user should not have the impression the program froze.
  • Loading branch information
dexX7 committed Apr 15, 2015
1 parent 0c80d4f commit 3d4e079
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/mastercore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1577,6 +1577,7 @@ uint64_t txFee = 0;
// parse blocks, potential right from Mastercoin's Exodus
int msc_initial_scan(int nFirstBlock)
{
int64_t nNow = GetTime();
unsigned int nTotal = 0;
unsigned int nFound = 0;
int nBlock = 999999;
Expand All @@ -1588,6 +1589,12 @@ int msc_initial_scan(int nFirstBlock)

for (nBlock = nFirstBlock; nBlock <= nLastBlock; ++nBlock)
{
if (GetTime() >= nNow + 15) {
double dProgress = 100.0 * (nBlock - nFirstBlock) / (nLastBlock - nFirstBlock);
printf("Still scanning.. at block %d of %d. Progress: %.2f %%\n", nBlock, nLastBlock, dProgress);
nNow = GetTime();
}

CBlockIndex* pblockindex = chainActive[nBlock];
if (NULL == pblockindex) break;
std::string strBlockHash = pblockindex->GetBlockHash().GetHex();
Expand Down

3 comments on commit 3d4e079

@zathras-crypto
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think (purely subjective here) 30, maybe even 60 seconds would be a more appropriate figure - mainnet takes roughly 45 to 60 minutes for a full parse from scratch on average hardware so every 15 seconds would be ~250 "Still scanning" updates - again purely subjective but that seems perhaps a bit excessive.

Also did you take a look at putting this into splash? That would be extremely beneficial also - I can take a nose around if you like :)

@dexX7
Copy link
Owner Author

@dexX7 dexX7 commented on 3d4e079 Apr 16, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hehe, maybe I'm too impatient, but 60 seconds feels definitely too long. 30 seconds is probably a fine middle ground then.

I haven't really looked into the splash screen yet, but the wallet uses a Boost signal ShowProgress(const std::string &title, int nProgress), which actually looks pretty useable.

@zathras-crypto
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hehe, maybe I'm too impatient, but 60 seconds feels definitely too long. 30 seconds is probably a fine middle ground then.

30 sounds good :)

I haven't really looked into the splash screen yet, but the wallet uses a Boost signal ShowProgress(const std::string &title, int nProgress), which actually looks pretty useable.

You should just be able to use the existing methods mate, haven't tested but you should be able to include ui_interface.h and then use InitMessage (eg uiInterface.InitMessage(_("Parsing Omni Layer transactions (block n of m)..."));

Please sign in to comment.