Replace CScriptID and CKeyID in CTxDestination with dedicated type

This commit is contained in:
Gregory Sanders 2019-02-19 17:00:45 -05:00 committed by Steven Roose
parent 3e7cff1e45
commit aa375e66c1
No known key found for this signature in database
GPG key ID: 7FC91380BB4CE800
28 changed files with 201 additions and 179 deletions

View file

@ -228,7 +228,7 @@ public:
}
};
CScript P2PKHGetScript(const CPubKey& pubkey) { return GetScriptForDestination(pubkey.GetID()); }
CScript P2PKHGetScript(const CPubKey& pubkey) { return GetScriptForDestination(PKHash(pubkey)); }
CScript P2PKGetScript(const CPubKey& pubkey) { return GetScriptForRawPubKey(pubkey); }
CScript P2WPKHGetScript(const CPubKey& pubkey) { return GetScriptForDestination(WitnessV0KeyHash(pubkey.GetID())); }
@ -320,7 +320,7 @@ public:
}
};
CScript ConvertP2SH(const CScript& script) { return GetScriptForDestination(CScriptID(script)); }
CScript ConvertP2SH(const CScript& script) { return GetScriptForDestination(ScriptHash(script)); }
CScript ConvertP2WSH(const CScript& script) { return GetScriptForDestination(WitnessV0ScriptHash(script)); }
/** A parsed combo(P) descriptor. */
@ -347,14 +347,14 @@ public:
CKeyID keyid = key.GetID();
{
CScript p2pk = GetScriptForRawPubKey(key);
CScript p2pkh = GetScriptForDestination(keyid);
CScript p2pkh = GetScriptForDestination(PKHash(keyid));
output_scripts = std::vector<CScript>{std::move(p2pk), std::move(p2pkh)};
out.pubkeys.emplace(keyid, key);
}
if (key.IsCompressed()) {
CScript p2wpkh = GetScriptForDestination(WitnessV0KeyHash(keyid));
CScriptID p2wpkh_id(p2wpkh);
CScript p2sh_p2wpkh = GetScriptForDestination(p2wpkh_id);
CScript p2sh_p2wpkh = GetScriptForDestination(ScriptHash(p2wpkh_id));
out.scripts.emplace(p2wpkh_id, p2wpkh);
output_scripts.push_back(std::move(p2wpkh));
output_scripts.push_back(std::move(p2sh_p2wpkh));