Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/walletdb.cpp
Show First 20 Lines • Show All 292 Lines • ▼ Show 20 Lines | try { | ||||
ssKey >> strAddress; | ssKey >> strAddress; | ||||
ssValue >> pwallet | ssValue >> pwallet | ||||
->mapAddressBook[DecodeDestination( | ->mapAddressBook[DecodeDestination( | ||||
strAddress, pwallet->chainParams)] | strAddress, pwallet->chainParams)] | ||||
.purpose; | .purpose; | ||||
} else if (strType == "tx") { | } else if (strType == "tx") { | ||||
TxId txid; | TxId txid; | ||||
ssKey >> txid; | ssKey >> txid; | ||||
CWalletTx wtx; | CWalletTx wtx(nullptr /* pwallet */, MakeTransactionRef()); | ||||
ssValue >> wtx; | ssValue >> wtx; | ||||
CValidationState state; | CValidationState state; | ||||
bool isValid = wtx.IsCoinBase() | bool isValid = wtx.IsCoinBase() | ||||
? CheckCoinbase(wtx, state) | ? CheckCoinbase(wtx, state) | ||||
: CheckRegularTransaction(wtx, state); | : CheckRegularTransaction(wtx, state); | ||||
if (!isValid || wtx.GetId() != txid) { | if (!isValid || wtx.GetId() != txid) { | ||||
return false; | return false; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 296 Lines • ▼ Show 20 Lines | LogPrintf("Keys: %u plaintext, %u encrypted, %u w/ metadata, %u total\n", | ||||
wss.nKeys, wss.nCKeys, wss.nKeyMeta, wss.nKeys + wss.nCKeys); | wss.nKeys, wss.nCKeys, wss.nKeyMeta, wss.nKeys + wss.nCKeys); | ||||
// nTimeFirstKey is only reliable if all keys have metadata | // nTimeFirstKey is only reliable if all keys have metadata | ||||
if ((wss.nKeys + wss.nCKeys + wss.nWatchKeys) != wss.nKeyMeta) { | if ((wss.nKeys + wss.nCKeys + wss.nWatchKeys) != wss.nKeyMeta) { | ||||
pwallet->UpdateTimeFirstKey(1); | pwallet->UpdateTimeFirstKey(1); | ||||
} | } | ||||
for (const TxId &txid : wss.vWalletUpgrade) { | for (const TxId &txid : wss.vWalletUpgrade) { | ||||
WriteTx(pwallet->mapWallet[txid]); | WriteTx(pwallet->mapWallet.at(txid)); | ||||
} | } | ||||
// Rewrite encrypted wallets of versions 0.4.0 and 0.5.0rc: | // Rewrite encrypted wallets of versions 0.4.0 and 0.5.0rc: | ||||
if (wss.fIsEncrypted && | if (wss.fIsEncrypted && | ||||
(wss.nFileVersion == 40000 || wss.nFileVersion == 50000)) { | (wss.nFileVersion == 40000 || wss.nFileVersion == 50000)) { | ||||
return DB_NEED_REWRITE; | return DB_NEED_REWRITE; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | try { | ||||
} | } | ||||
std::string strType; | std::string strType; | ||||
ssKey >> strType; | ssKey >> strType; | ||||
if (strType == "tx") { | if (strType == "tx") { | ||||
TxId txid; | TxId txid; | ||||
ssKey >> txid; | ssKey >> txid; | ||||
CWalletTx wtx; | CWalletTx wtx(nullptr /* pwallet */, MakeTransactionRef()); | ||||
ssValue >> wtx; | ssValue >> wtx; | ||||
txIds.push_back(txid); | txIds.push_back(txid); | ||||
vWtx.push_back(wtx); | vWtx.push_back(wtx); | ||||
} | } | ||||
} | } | ||||
pcursor->close(); | pcursor->close(); | ||||
} catch (const boost::thread_interrupted &) { | } catch (const boost::thread_interrupted &) { | ||||
▲ Show 20 Lines • Show All 205 Lines • Show Last 20 Lines |