mirror of
https://github.com/dogecoin/dogecoin.git
synced 2026-02-25 06:39:01 +00:00
Merge pull request #676 from rnicoll/1.8.1-dev-redeem
Redeem script changes from Bitcoin Core 0.9.3
This commit is contained in:
commit
48eee89cdf
@ -522,7 +522,7 @@ Value signrawtransaction(const Array& params, bool fHelp)
|
||||
" \"txid\":\"id\", (string, required) The transaction id\n"
|
||||
" \"vout\":n, (numeric, required) The output number\n"
|
||||
" \"scriptPubKey\": \"hex\", (string, required) script key\n"
|
||||
" \"redeemScript\": \"hex\" (string, required) redeem script\n"
|
||||
" \"redeemScript\": \"hex\" (string, required for P2SH) redeem script\n"
|
||||
" }\n"
|
||||
" ,...\n"
|
||||
" ]\n"
|
||||
|
||||
@ -130,6 +130,22 @@ bool CWallet::AddCScript(const CScript& redeemScript)
|
||||
return CWalletDB(strWalletFile).WriteCScript(Hash160(redeemScript), redeemScript);
|
||||
}
|
||||
|
||||
bool CWallet::LoadCScript(const CScript& redeemScript)
|
||||
{
|
||||
/* A sanity check was added in Bitcoin Core pull #3843 to avoid adding redeemScripts
|
||||
* that never can be redeemed. However, old wallets may still contain
|
||||
* these. Do not add them to the wallet and warn. */
|
||||
if (redeemScript.size() > MAX_SCRIPT_ELEMENT_SIZE)
|
||||
{
|
||||
std::string strAddr = CBitcoinAddress(redeemScript.GetID()).ToString();
|
||||
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",
|
||||
__func__, redeemScript.size(), MAX_SCRIPT_ELEMENT_SIZE, strAddr);
|
||||
return true;
|
||||
}
|
||||
|
||||
return CCryptoKeyStore::AddCScript(redeemScript);
|
||||
}
|
||||
|
||||
bool CWallet::Unlock(const SecureString& strWalletPassphrase)
|
||||
{
|
||||
CCrypter crypter;
|
||||
|
||||
@ -398,7 +398,7 @@ public:
|
||||
// Adds an encrypted key to the store, without saving it to disk (used by LoadWallet)
|
||||
bool LoadCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret);
|
||||
bool AddCScript(const CScript& redeemScript);
|
||||
bool LoadCScript(const CScript& redeemScript) { return CCryptoKeyStore::AddCScript(redeemScript); }
|
||||
bool LoadCScript(const CScript& redeemScript);
|
||||
|
||||
/// Adds a destination data tuple to the store, and saves it to disk
|
||||
bool AddDestData(const CTxDestination &dest, const std::string &key, const std::string &value);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user