@@ -45,14 +45,14 @@ const std::string& FormatOutputType(OutputType type)
4545CTxDestination GetDestinationForKey (const CPubKey& key, OutputType type)
4646{
4747 switch (type) {
48- case OutputType::LEGACY: return key. GetID ( );
48+ case OutputType::LEGACY: return PKHash (key );
4949 case OutputType::P2SH_SEGWIT:
5050 case OutputType::BECH32: {
51- if (!key.IsCompressed ()) return key. GetID ( );
52- CTxDestination witdest = WitnessV0KeyHash (key. GetID ( ));
51+ if (!key.IsCompressed ()) return PKHash (key );
52+ CTxDestination witdest = WitnessV0KeyHash (PKHash (key ));
5353 CScript witprog = GetScriptForDestination (witdest);
5454 if (type == OutputType::P2SH_SEGWIT) {
55- return CScriptID (witprog);
55+ return ScriptHash (witprog);
5656 } else {
5757 return witdest;
5858 }
@@ -63,10 +63,10 @@ CTxDestination GetDestinationForKey(const CPubKey& key, OutputType type)
6363
6464std::vector<CTxDestination> GetAllDestinationsForKey (const CPubKey& key)
6565{
66- CKeyID keyid = key. GetID ( );
66+ PKHash keyid (key );
6767 if (key.IsCompressed ()) {
6868 CTxDestination segwit = WitnessV0KeyHash (keyid);
69- CTxDestination p2sh = CScriptID (GetScriptForDestination (segwit));
69+ CTxDestination p2sh = ScriptHash (GetScriptForDestination (segwit));
7070 return std::vector<CTxDestination>{std::move (keyid), std::move (p2sh), std::move (segwit)};
7171 } else {
7272 return std::vector<CTxDestination>{std::move (keyid)};
@@ -80,19 +80,19 @@ CTxDestination AddAndGetDestinationForScript(CKeyStore& keystore, const CScript&
8080 // Note that scripts over 520 bytes are not yet supported.
8181 switch (type) {
8282 case OutputType::LEGACY:
83- return CScriptID (script);
83+ return ScriptHash (script);
8484 case OutputType::P2SH_SEGWIT:
8585 case OutputType::BECH32: {
8686 CTxDestination witdest = WitnessV0ScriptHash (script);
8787 CScript witprog = GetScriptForDestination (witdest);
8888 // Check if the resulting program is solvable (i.e. doesn't use an uncompressed key)
89- if (!IsSolvable (keystore, witprog)) return CScriptID (script);
89+ if (!IsSolvable (keystore, witprog)) return ScriptHash (script);
9090 // Add the redeemscript, so that P2WSH and P2SH-P2WSH outputs are recognized as ours.
9191 keystore.AddCScript (witprog);
9292 if (type == OutputType::BECH32) {
9393 return witdest;
9494 } else {
95- return CScriptID (witprog);
95+ return ScriptHash (witprog);
9696 }
9797 }
9898 default : assert (false );
0 commit comments