| 2086 | |
| 2087 | |
| 2088 | DBErrors CWallet::LoadWallet(bool& fFirstRunRet) |
| 2089 | { |
| 2090 | if (!fFileBacked) |
| 2091 | return DB_LOAD_OK; |
| 2092 | fFirstRunRet = false; |
| 2093 | DBErrors nLoadWalletRet = CWalletDB(strWalletFile,"cr+").LoadWallet(this); |
| 2094 | if (nLoadWalletRet == DB_NEED_REWRITE) |
| 2095 | { |
| 2096 | if (CDB::Rewrite(strWalletFile, "\x04pool")) |
| 2097 | { |
| 2098 | LOCK(cs_wallet); |
| 2099 | setKeyPool.clear(); |
| 2100 | // Note: can't top-up keypool here, because wallet is locked. |
| 2101 | // User will be prompted to unlock wallet the next operation |
| 2102 | // that requires a new key. |
| 2103 | } |
| 2104 | } |
| 2105 | |
| 2106 | if (nLoadWalletRet != DB_LOAD_OK) |
| 2107 | return nLoadWalletRet; |
| 2108 | fFirstRunRet = !vchDefaultKey.IsValid(); |
| 2109 | |
| 2110 | uiInterface.LoadWallet(this); |
| 2111 | |
| 2112 | return DB_LOAD_OK; |
| 2113 | } |
| 2114 | |
| 2115 | |
| 2116 | DBErrors CWallet::ZapWalletTx(std::vector<CWalletTx>& vWtx) |