aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.cpp
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@bitpay.com>2013-06-10 09:38:13 -0400
committerJeff Garzik <jgarzik@bitpay.com>2013-06-10 09:38:13 -0400
commit8da9dd0725ea90b1fd085d9551177fe62d7a9ba2 (patch)
treefc00abe9a78626ea741a715b9d4b36bdb6dc5c7c /src/wallet.cpp
parent3869fb89b60091281b43a35921057ba3f43c18f0 (diff)
downloadbitcoin-8da9dd0725ea90b1fd085d9551177fe62d7a9ba2.tar.xz
Wallet: optimize rescan to skip blocks prior to birthday
Diffstat (limited to 'src/wallet.cpp')
-rw-r--r--src/wallet.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp
index aa13711110..9a4a92cd5f 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -790,6 +790,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->GetNextInMainChain();
+ continue;
+ }
+
CBlock block;
block.ReadFromDisk(pindex);
BOOST_FOREACH(CTransaction& tx, block.vtx)