Automatically rescan after restoring wallet.dat
Information about the best known chain is added to wallet.dat. If this information does not match the data in blkindex.dat, a rescan is automatically performed, starting from the the last known block. When upgrading from a wallet which does not have this information, no rescan is done automatically.
This commit is contained in:
committed by
Gavin Andresen
parent
657cfe721b
commit
6a76c60e6c
12
db.h
12
db.h
@@ -13,6 +13,7 @@ class CAddress;
|
||||
class CWalletTx;
|
||||
class CAccount;
|
||||
class CAccountingEntry;
|
||||
class CBlockLocator;
|
||||
|
||||
extern map<string, string> mapAddressBook;
|
||||
extern CCriticalSection cs_mapAddressBook;
|
||||
@@ -405,6 +406,17 @@ public:
|
||||
return Write(make_pair(string("key"), vchPubKey), vchPrivKey, false);
|
||||
}
|
||||
|
||||
bool WriteBestBlock(const CBlockLocator& locator)
|
||||
{
|
||||
nWalletDBUpdated++;
|
||||
return Write(string("bestblock"), locator);
|
||||
}
|
||||
|
||||
bool ReadBestBlock(CBlockLocator& locator)
|
||||
{
|
||||
return Read(string("bestblock"), locator);
|
||||
}
|
||||
|
||||
bool ReadDefaultKey(vector<unsigned char>& vchPubKey)
|
||||
{
|
||||
vchPubKey.clear();
|
||||
|
||||
Reference in New Issue
Block a user