|
|
|
@ -94,23 +94,23 @@ bool CWalletDB::WriteMasterKey(unsigned int nID, const CMasterKey& kMasterKey)
|
|
|
|
|
|
|
|
|
|
bool CWalletDB::WriteCScript(const uint160& hash, const CScript& redeemScript)
|
|
|
|
|
{
|
|
|
|
|
return WriteIC(std::make_pair(std::string("cscript"), hash), *(const CScriptBase*)(&redeemScript), false);
|
|
|
|
|
return WriteIC(std::make_pair(std::string("cscript"), hash), redeemScript, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CWalletDB::WriteWatchOnly(const CScript &dest, const CKeyMetadata& keyMeta)
|
|
|
|
|
{
|
|
|
|
|
if (!WriteIC(std::make_pair(std::string("watchmeta"), *(const CScriptBase*)(&dest)), keyMeta)) {
|
|
|
|
|
if (!WriteIC(std::make_pair(std::string("watchmeta"), dest), keyMeta)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return WriteIC(std::make_pair(std::string("watchs"), *(const CScriptBase*)(&dest)), '1');
|
|
|
|
|
return WriteIC(std::make_pair(std::string("watchs"), dest), '1');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CWalletDB::EraseWatchOnly(const CScript &dest)
|
|
|
|
|
{
|
|
|
|
|
if (!EraseIC(std::make_pair(std::string("watchmeta"), *(const CScriptBase*)(&dest)))) {
|
|
|
|
|
if (!EraseIC(std::make_pair(std::string("watchmeta"), dest))) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return EraseIC(std::make_pair(std::string("watchs"), *(const CScriptBase*)(&dest)));
|
|
|
|
|
return EraseIC(std::make_pair(std::string("watchs"), dest));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CWalletDB::WriteBestBlock(const CBlockLocator& locator)
|
|
|
|
@ -323,7 +323,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
|
|
|
|
|
{
|
|
|
|
|
wss.nWatchKeys++;
|
|
|
|
|
CScript script;
|
|
|
|
|
ssKey >> *(CScriptBase*)(&script);
|
|
|
|
|
ssKey >> script;
|
|
|
|
|
char fYes;
|
|
|
|
|
ssValue >> fYes;
|
|
|
|
|
if (fYes == '1')
|
|
|
|
@ -440,7 +440,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
|
|
|
|
|
else if (strType == "watchmeta")
|
|
|
|
|
{
|
|
|
|
|
CScript script;
|
|
|
|
|
ssKey >> *(CScriptBase*)(&script);
|
|
|
|
|
ssKey >> script;
|
|
|
|
|
keyID = CScriptID(script);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -474,7 +474,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
|
|
|
|
|
uint160 hash;
|
|
|
|
|
ssKey >> hash;
|
|
|
|
|
CScript script;
|
|
|
|
|
ssValue >> *(CScriptBase*)(&script);
|
|
|
|
|
ssValue >> script;
|
|
|
|
|
if (!pwallet->LoadCScript(script))
|
|
|
|
|
{
|
|
|
|
|
strErr = "Error reading wallet database: LoadCScript failed";
|
|
|
|
|