File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,22 @@ bool CWallet::AddCScript(const CScript& redeemScript)
128
128
return CWalletDB (strWalletFile).WriteCScript (Hash160 (redeemScript), redeemScript);
129
129
}
130
130
131
+ bool CWallet::LoadCScript (const CScript& redeemScript)
132
+ {
133
+ /* A sanity check was added in pull #3843 to avoid adding redeemScripts
134
+ * that never can be redeemed. However, old wallets may still contain
135
+ * these. Do not add them to the wallet and warn. */
136
+ if (redeemScript.size () > MAX_SCRIPT_ELEMENT_SIZE)
137
+ {
138
+ std::string strAddr = CBitcoinAddress (redeemScript.GetID ()).ToString ();
139
+ LogPrintf (" %s: Warning: This wallet contains a redeemScript of size %i which exceeds maximum size %i thus can never be redeemed. Do not use address %s.\n " ,
140
+ __func__, redeemScript.size (), MAX_SCRIPT_ELEMENT_SIZE, strAddr);
141
+ return true ;
142
+ }
143
+
144
+ return CCryptoKeyStore::AddCScript (redeemScript);
145
+ }
146
+
131
147
bool CWallet::Unlock (const SecureString& strWalletPassphrase)
132
148
{
133
149
CCrypter crypter;
Original file line number Diff line number Diff line change @@ -211,7 +211,7 @@ class CWallet : public CCryptoKeyStore, public CWalletInterface
211
211
// Adds an encrypted key to the store, without saving it to disk (used by LoadWallet)
212
212
bool LoadCryptedKey (const CPubKey &vchPubKey, const std::vector<unsigned char > &vchCryptedSecret);
213
213
bool AddCScript (const CScript& redeemScript);
214
- bool LoadCScript (const CScript& redeemScript) { return CCryptoKeyStore::AddCScript (redeemScript); }
214
+ bool LoadCScript (const CScript& redeemScript);
215
215
216
216
// / Adds a destination data tuple to the store, and saves it to disk
217
217
bool AddDestData (const CTxDestination &dest, const std::string &key, const std::string &value);
You can’t perform that action at this time.
0 commit comments