Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/walletdb.cpp
Show First 20 Lines • Show All 278 Lines • ▼ Show 20 Lines | bool ReadKeyValue(CWallet *pwallet, CDataStream &ssKey, CDataStream &ssValue, | ||||
try { | try { | ||||
// Unserialize | // Unserialize | ||||
// Taking advantage of the fact that pair serialization is just the two | // Taking advantage of the fact that pair serialization is just the two | ||||
// items serialized one after the other. | // items serialized one after the other. | ||||
ssKey >> strType; | ssKey >> strType; | ||||
if (strType == "name") { | if (strType == "name") { | ||||
std::string strAddress; | std::string strAddress; | ||||
ssKey >> strAddress; | ssKey >> strAddress; | ||||
ssValue >> | ssValue >> pwallet | ||||
pwallet->mapAddressBook[DecodeDestination(strAddress)].name; | ->mapAddressBook[DecodeDestination( | ||||
strAddress, pwallet->chainParams)] | |||||
.name; | |||||
} else if (strType == "purpose") { | } else if (strType == "purpose") { | ||||
std::string strAddress; | std::string strAddress; | ||||
ssKey >> strAddress; | ssKey >> strAddress; | ||||
ssValue >> | ssValue >> pwallet | ||||
pwallet->mapAddressBook[DecodeDestination(strAddress)].purpose; | ->mapAddressBook[DecodeDestination( | ||||
strAddress, pwallet->chainParams)] | |||||
.purpose; | |||||
} else if (strType == "tx") { | } else if (strType == "tx") { | ||||
uint256 hash; | uint256 hash; | ||||
ssKey >> hash; | ssKey >> hash; | ||||
CWalletTx wtx; | CWalletTx wtx; | ||||
ssValue >> wtx; | ssValue >> wtx; | ||||
CValidationState state; | CValidationState state; | ||||
bool isValid = wtx.IsCoinBase() | bool isValid = wtx.IsCoinBase() | ||||
? CheckCoinbase(wtx, state) | ? CheckCoinbase(wtx, state) | ||||
▲ Show 20 Lines • Show All 191 Lines • ▼ Show 20 Lines | try { | ||||
} | } | ||||
} else if (strType == "orderposnext") { | } else if (strType == "orderposnext") { | ||||
ssValue >> pwallet->nOrderPosNext; | ssValue >> pwallet->nOrderPosNext; | ||||
} else if (strType == "destdata") { | } else if (strType == "destdata") { | ||||
std::string strAddress, strKey, strValue; | std::string strAddress, strKey, strValue; | ||||
ssKey >> strAddress; | ssKey >> strAddress; | ||||
ssKey >> strKey; | ssKey >> strKey; | ||||
ssValue >> strValue; | ssValue >> strValue; | ||||
if (!pwallet->LoadDestData(DecodeDestination(strAddress), strKey, | if (!pwallet->LoadDestData( | ||||
DecodeDestination(strAddress, pwallet->chainParams), strKey, | |||||
strValue)) { | strValue)) { | ||||
strErr = "Error reading wallet database: LoadDestData failed"; | strErr = "Error reading wallet database: LoadDestData failed"; | ||||
return false; | return false; | ||||
} | } | ||||
} else if (strType == "hdchain") { | } else if (strType == "hdchain") { | ||||
CHDChain chain; | CHDChain chain; | ||||
ssValue >> chain; | ssValue >> chain; | ||||
if (!pwallet->SetHDChain(chain, true)) { | if (!pwallet->SetHDChain(chain, true)) { | ||||
strErr = "Error reading wallet database: SetHDChain failed"; | strErr = "Error reading wallet database: SetHDChain failed"; | ||||
▲ Show 20 Lines • Show All 381 Lines • Show Last 20 Lines |