X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fwallet.cpp;h=88d661e1fb39de14f0d5bc560a0651f0aaee1150;hb=24c742a46d44c8f10a2a94d1bd5227e8a0ae30ed;hp=45823f678c30c882b2d268db83b2c6f6bcf433fd;hpb=52c85881648d3381c29da10925c06cbd083cc570;p=novacoin.git diff --git a/src/wallet.cpp b/src/wallet.cpp index 45823f6..88d661e 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1081,7 +1081,7 @@ void CWallet::ResendWalletTransactions() { // Do this infrequently and randomly to avoid giving away // that these are our transactions. - static int64_t nNextTime; + static int64_t nNextTime = GetRand(GetTime() + 30 * 60); if (GetTime() < nNextTime) return; bool fFirst = (nNextTime == 0); @@ -1090,7 +1090,7 @@ void CWallet::ResendWalletTransactions() return; // Only do it if there's been a new block since last time - static int64_t nLastTime; + static int64_t nLastTime = 0; if (nTimeBestReceived < nLastTime) return; nLastTime = GetTime(); @@ -2243,6 +2243,28 @@ DBErrors CWallet::LoadWallet(bool& fFirstRunRet) return DB_LOAD_OK; } +DBErrors CWallet::ZapWalletTx() +{ + if (!fFileBacked) + return DB_LOAD_OK; + DBErrors nZapWalletTxRet = CWalletDB(strWalletFile,"cr+").ZapWalletTx(this); + if (nZapWalletTxRet == DB_NEED_REWRITE) + { + if (CDB::Rewrite(strWalletFile, "\x04pool")) + { + LOCK(cs_wallet); + setKeyPool.clear(); + // Note: can't top-up keypool here, because wallet is locked. + // User will be prompted to unlock wallet the next operation + // the requires a new key. + } + } + + if (nZapWalletTxRet != DB_LOAD_OK) + return nZapWalletTxRet; + + return DB_LOAD_OK; +} bool CWallet::SetAddressBookName(const CTxDestination& address, const string& strName) {