This commit is contained in:
jl777
2018-04-17 16:25:27 +03:00
parent ccff4876b9
commit cf53fd7c3d
4 changed files with 36 additions and 20 deletions

View File

@@ -3041,15 +3041,25 @@ CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarge
}
void komodo_prefetch(FILE *fp);
DBErrors CWallet::LoadWallet(bool& fFirstRunRet)
{
if (!fFileBacked)
return DB_LOAD_OK;
fFirstRunRet = false;
DBErrors nLoadWalletRet = CWalletDB(strWalletFile,"cr+").LoadWallet(this);
fprintf(stderr,"loading wallet %s %u\n",strWalletFile.c_str(),(uint32_t)time(NULL));
{
FILE *fp;
if ( (fp= fopen(strWalletFile.c_str(),"rb")) != 0 )
{
komodo_prefetch(fp);
fclose(fp);
}
}
fprintf(stderr,"prefetched wallet %s %u\n",strWalletFile.c_str(),(uint32_t)time(NULL));
DBErrors nLoadWalletRet = CWalletDB(strWalletFile,"cr+").LoadWallet(this);
fprintf(stderr,"loaded wallet %s %u\n",strWalletFile.c_str(),(uint32_t)time(NULL));
if (nLoadWalletRet == DB_NEED_REWRITE)
{
if (CDB::Rewrite(strWalletFile, "\x04pool"))