Convert CPubKey to WitnessV0KeyHash directly

The round-tripping through PKHash has no effect, and is
potentially misleading as such.
This commit is contained in:
Ben Woosley
2020-01-14 23:46:14 -08:00
parent 3fcc468123
commit a9e451f144
4 changed files with 6 additions and 4 deletions

View File

@@ -53,7 +53,7 @@ CTxDestination GetDestinationForKey(const CPubKey& key, OutputType type)
case OutputType::P2SH_SEGWIT:
case OutputType::BECH32: {
if (!key.IsCompressed()) return PKHash(key);
CTxDestination witdest = WitnessV0KeyHash(PKHash(key));
CTxDestination witdest = WitnessV0KeyHash(key);
CScript witprog = GetScriptForDestination(witdest);
if (type == OutputType::P2SH_SEGWIT) {
return ScriptHash(witprog);