From 95c7db3dbf4012dd02e5f1f30e6d982341facaa6 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Wed, 22 May 2013 20:58:53 +0200 Subject: More bestblock records in wallets Write bestblock records in wallets: * Every 20160 blocks synced, no matter what (before: none during IBD) * Every 144 blocks after IBD (before: for every block, slow) * When creating a new wallet * At shutdown This should result in far fewer spurious rescans. --- src/init.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index d619cb4121..ebd9dee7b2 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -100,6 +100,7 @@ void Shutdown() StopNode(); { LOCK(cs_main); + pwalletMain->SetBestChain(CBlockLocator(pindexBest)); if (pblocktree) pblocktree->Flush(); if (pcoinsTip) @@ -998,6 +999,8 @@ bool AppInit2(boost::thread_group& threadGroup) if (!pwalletMain->SetAddressBookName(pwalletMain->vchDefaultKey.GetID(), "")) strErrors << _("Cannot write default address") << "\n"; } + + pwalletMain->SetBestChain(CBlockLocator(pindexBest)); } printf("%s", strErrors.str().c_str()); -- cgit v1.2.3