Permalink
Browse files

Wallet Fixes dealing with birthday

  • Loading branch information...
Tranz5 committed Apr 28, 2014
1 parent 82c20fd commit 952ef63b599b584b84e2ceba4c73594e07c949fe
Showing with 10 additions and 0 deletions.
  1. +7 −0 src/wallet.cpp
  2. +3 −0 src/walletdb.cpp
View
@@ -867,6 +867,13 @@ int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
LOCK(cs_wallet);
while (pindex)
{
// no need to read and scan block, if block was created before
// our wallet birthday (as adjusted for block time variability)
if (nTimeFirstKey && (pindex->nTime < (nTimeFirstKey - 7200))) {
pindex = pindex->pnext;
continue;
}
CBlock block;
block.ReadFromDisk(pindex, true);
BOOST_FOREACH(CTransaction& tx, block.vtx)
View
@@ -814,6 +814,9 @@ bool ImportWallet(CWallet *pwallet, const string& strLocation)
while (pindex && pindex->pprev && pindex->nTime > nTimeBegin - 7200)
pindex = pindex->pprev;
if (!pwallet->nTimeFirstKey || nTimeBegin < pwallet->nTimeFirstKey)
pwallet->nTimeFirstKey = nTimeBegin;
printf("Rescanning last %i blocks\n", pindexBest->nHeight - pindex->nHeight + 1);
pwallet->ScanForWalletTransactions(pindex);
pwallet->ReacceptWalletTransactions();

0 comments on commit 952ef63

Please sign in to comment.