|
|
@ -94,23 +94,23 @@ bool CWalletDB::WriteMasterKey(unsigned int nID, const CMasterKey& kMasterKey) |
|
|
|
|
|
|
|
|
|
|
|
bool CWalletDB::WriteCScript(const uint160& hash, const CScript& redeemScript) |
|
|
|
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) |
|
|
|
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 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) |
|
|
|
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 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) |
|
|
|
bool CWalletDB::WriteBestBlock(const CBlockLocator& locator) |
|
|
@ -323,7 +323,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, |
|
|
|
{ |
|
|
|
{ |
|
|
|
wss.nWatchKeys++; |
|
|
|
wss.nWatchKeys++; |
|
|
|
CScript script; |
|
|
|
CScript script; |
|
|
|
ssKey >> *(CScriptBase*)(&script); |
|
|
|
ssKey >> script; |
|
|
|
char fYes; |
|
|
|
char fYes; |
|
|
|
ssValue >> fYes; |
|
|
|
ssValue >> fYes; |
|
|
|
if (fYes == '1') |
|
|
|
if (fYes == '1') |
|
|
@ -440,7 +440,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, |
|
|
|
else if (strType == "watchmeta") |
|
|
|
else if (strType == "watchmeta") |
|
|
|
{ |
|
|
|
{ |
|
|
|
CScript script; |
|
|
|
CScript script; |
|
|
|
ssKey >> *(CScriptBase*)(&script); |
|
|
|
ssKey >> script; |
|
|
|
keyID = CScriptID(script); |
|
|
|
keyID = CScriptID(script); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -474,7 +474,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, |
|
|
|
uint160 hash; |
|
|
|
uint160 hash; |
|
|
|
ssKey >> hash; |
|
|
|
ssKey >> hash; |
|
|
|
CScript script; |
|
|
|
CScript script; |
|
|
|
ssValue >> *(CScriptBase*)(&script); |
|
|
|
ssValue >> script; |
|
|
|
if (!pwallet->LoadCScript(script)) |
|
|
|
if (!pwallet->LoadCScript(script)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
strErr = "Error reading wallet database: LoadCScript failed"; |
|
|
|
strErr = "Error reading wallet database: LoadCScript failed"; |
|
|
|