Also remove pay-2-pubkey from watch when adding a priv key
This commit is contained in:
parent
6d6b11e793
commit
cfc3dd3428
@ -286,6 +286,11 @@ CScript GetScriptForDestination(const CTxDestination& dest)
|
|||||||
return script;
|
return script;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CScript GetScriptForRawPubKey(const CPubKey& pubKey)
|
||||||
|
{
|
||||||
|
return CScript() << std::vector<unsigned char>(pubKey.begin(), pubKey.end()) << OP_CHECKSIG;
|
||||||
|
}
|
||||||
|
|
||||||
CScript GetScriptForMultisig(int nRequired, const std::vector<CPubKey>& keys)
|
CScript GetScriptForMultisig(int nRequired, const std::vector<CPubKey>& keys)
|
||||||
{
|
{
|
||||||
CScript script;
|
CScript script;
|
||||||
|
@ -73,6 +73,7 @@ bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet)
|
|||||||
bool ExtractDestinations(const CScript& scriptPubKey, txnouttype& typeRet, std::vector<CTxDestination>& addressRet, int& nRequiredRet);
|
bool ExtractDestinations(const CScript& scriptPubKey, txnouttype& typeRet, std::vector<CTxDestination>& addressRet, int& nRequiredRet);
|
||||||
|
|
||||||
CScript GetScriptForDestination(const CTxDestination& dest);
|
CScript GetScriptForDestination(const CTxDestination& dest);
|
||||||
|
CScript GetScriptForRawPubKey(const CPubKey& pubkey);
|
||||||
CScript GetScriptForMultisig(int nRequired, const std::vector<CPubKey>& keys);
|
CScript GetScriptForMultisig(int nRequired, const std::vector<CPubKey>& keys);
|
||||||
|
|
||||||
#endif // BITCOIN_SCRIPT_STANDARD_H
|
#endif // BITCOIN_SCRIPT_STANDARD_H
|
||||||
|
@ -106,6 +106,9 @@ bool CWallet::AddKeyPubKey(const CKey& secret, const CPubKey &pubkey)
|
|||||||
// check if we need to remove from watch-only
|
// check if we need to remove from watch-only
|
||||||
CScript script;
|
CScript script;
|
||||||
script = GetScriptForDestination(pubkey.GetID());
|
script = GetScriptForDestination(pubkey.GetID());
|
||||||
|
if (HaveWatchOnly(script))
|
||||||
|
RemoveWatchOnly(script);
|
||||||
|
script = GetScriptForRawPubKey(pubkey);
|
||||||
if (HaveWatchOnly(script))
|
if (HaveWatchOnly(script))
|
||||||
RemoveWatchOnly(script);
|
RemoveWatchOnly(script);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user