|
|
@ -646,20 +646,17 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet) |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
DBErrors CWalletDB::FindWalletTx(CWallet* pwallet, vector<uint256>& vTxHash, vector<CWalletTx>& vWtx) |
|
|
|
DBErrors CWalletDB::FindWalletTx(vector<uint256>& vTxHash, vector<CWalletTx>& vWtx) |
|
|
|
{ |
|
|
|
{ |
|
|
|
pwallet->vchDefaultKey = CPubKey(); |
|
|
|
|
|
|
|
bool fNoncriticalErrors = false; |
|
|
|
bool fNoncriticalErrors = false; |
|
|
|
DBErrors result = DB_LOAD_OK; |
|
|
|
DBErrors result = DB_LOAD_OK; |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
LOCK(pwallet->cs_wallet); |
|
|
|
|
|
|
|
int nMinVersion = 0; |
|
|
|
int nMinVersion = 0; |
|
|
|
if (Read((string)"minversion", nMinVersion)) |
|
|
|
if (Read((string)"minversion", nMinVersion)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (nMinVersion > CLIENT_VERSION) |
|
|
|
if (nMinVersion > CLIENT_VERSION) |
|
|
|
return DB_TOO_NEW; |
|
|
|
return DB_TOO_NEW; |
|
|
|
pwallet->LoadMinVersion(nMinVersion); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Get cursor
|
|
|
|
// Get cursor
|
|
|
@ -712,12 +709,12 @@ DBErrors CWalletDB::FindWalletTx(CWallet* pwallet, vector<uint256>& vTxHash, vec |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
DBErrors CWalletDB::ZapSelectTx(CWallet* pwallet, vector<uint256>& vTxHashIn, vector<uint256>& vTxHashOut) |
|
|
|
DBErrors CWalletDB::ZapSelectTx(vector<uint256>& vTxHashIn, vector<uint256>& vTxHashOut) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// build list of wallet TXs and hashes
|
|
|
|
// build list of wallet TXs and hashes
|
|
|
|
vector<uint256> vTxHash; |
|
|
|
vector<uint256> vTxHash; |
|
|
|
vector<CWalletTx> vWtx; |
|
|
|
vector<CWalletTx> vWtx; |
|
|
|
DBErrors err = FindWalletTx(pwallet, vTxHash, vWtx); |
|
|
|
DBErrors err = FindWalletTx(vTxHash, vWtx); |
|
|
|
if (err != DB_LOAD_OK) { |
|
|
|
if (err != DB_LOAD_OK) { |
|
|
|
return err; |
|
|
|
return err; |
|
|
|
} |
|
|
|
} |
|
|
@ -736,7 +733,6 @@ DBErrors CWalletDB::ZapSelectTx(CWallet* pwallet, vector<uint256>& vTxHashIn, ve |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
else if ((*it) == hash) { |
|
|
|
else if ((*it) == hash) { |
|
|
|
pwallet->mapWallet.erase(hash); |
|
|
|
|
|
|
|
if(!EraseTx(hash)) { |
|
|
|
if(!EraseTx(hash)) { |
|
|
|
LogPrint("db", "Transaction was found for deletion but returned database error: %s\n", hash.GetHex()); |
|
|
|
LogPrint("db", "Transaction was found for deletion but returned database error: %s\n", hash.GetHex()); |
|
|
|
delerror = true; |
|
|
|
delerror = true; |
|
|
@ -751,11 +747,11 @@ DBErrors CWalletDB::ZapSelectTx(CWallet* pwallet, vector<uint256>& vTxHashIn, ve |
|
|
|
return DB_LOAD_OK; |
|
|
|
return DB_LOAD_OK; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
DBErrors CWalletDB::ZapWalletTx(CWallet* pwallet, vector<CWalletTx>& vWtx) |
|
|
|
DBErrors CWalletDB::ZapWalletTx(vector<CWalletTx>& vWtx) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// build list of wallet TXs
|
|
|
|
// build list of wallet TXs
|
|
|
|
vector<uint256> vTxHash; |
|
|
|
vector<uint256> vTxHash; |
|
|
|
DBErrors err = FindWalletTx(pwallet, vTxHash, vWtx); |
|
|
|
DBErrors err = FindWalletTx(vTxHash, vWtx); |
|
|
|
if (err != DB_LOAD_OK) |
|
|
|
if (err != DB_LOAD_OK) |
|
|
|
return err; |
|
|
|
return err; |
|
|
|
|
|
|
|
|
|
|
|