diff options
-rw-r--r-- | src/outputtype.cpp | 2 | ||||
-rw-r--r-- | src/script/standard.cpp | 1 | ||||
-rw-r--r-- | src/script/standard.h | 1 | ||||
-rw-r--r-- | src/wallet/test/ismine_tests.cpp | 6 |
4 files changed, 6 insertions, 4 deletions
diff --git a/src/outputtype.cpp b/src/outputtype.cpp index ea7a86d6d6..871474d56e 100644 --- a/src/outputtype.cpp +++ b/src/outputtype.cpp @@ -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); diff --git a/src/script/standard.cpp b/src/script/standard.cpp index b6ee6117d9..3e0a9e2304 100644 --- a/src/script/standard.cpp +++ b/src/script/standard.cpp @@ -21,6 +21,7 @@ CScriptID::CScriptID(const CScript& in) : uint160(Hash160(in.begin(), in.end())) ScriptHash::ScriptHash(const CScript& in) : uint160(Hash160(in.begin(), in.end())) {} PKHash::PKHash(const CPubKey& pubkey) : uint160(pubkey.GetID()) {} +WitnessV0KeyHash::WitnessV0KeyHash(const CPubKey& pubkey) : uint160(pubkey.GetID()) {} WitnessV0ScriptHash::WitnessV0ScriptHash(const CScript& in) { diff --git a/src/script/standard.h b/src/script/standard.h index 7c74d05be5..382d8d002b 100644 --- a/src/script/standard.h +++ b/src/script/standard.h @@ -103,6 +103,7 @@ struct WitnessV0KeyHash : public uint160 { WitnessV0KeyHash() : uint160() {} explicit WitnessV0KeyHash(const uint160& hash) : uint160(hash) {} + explicit WitnessV0KeyHash(const CPubKey& pubkey); }; //! CTxDestination subtype to encode any future Witness version diff --git a/src/wallet/test/ismine_tests.cpp b/src/wallet/test/ismine_tests.cpp index cdb0522920..e416f16044 100644 --- a/src/wallet/test/ismine_tests.cpp +++ b/src/wallet/test/ismine_tests.cpp @@ -167,7 +167,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard) keystore.SetupLegacyScriptPubKeyMan(); LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore); - CScript witnessscript = GetScriptForDestination(WitnessV0KeyHash(PKHash(pubkeys[0]))); + CScript witnessscript = GetScriptForDestination(WitnessV0KeyHash(pubkeys[0])); scriptPubKey = GetScriptForDestination(WitnessV0ScriptHash(witnessscript)); BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(witnessscript)); @@ -202,7 +202,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard) LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore); BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(keys[0])); - scriptPubKey = GetScriptForDestination(WitnessV0KeyHash(PKHash(pubkeys[0]))); + scriptPubKey = GetScriptForDestination(WitnessV0KeyHash(pubkeys[0])); // Keystore implicitly has key and P2SH redeemScript BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddCScript(scriptPubKey)); @@ -217,7 +217,7 @@ BOOST_AUTO_TEST_CASE(ismine_standard) LOCK(keystore.GetLegacyScriptPubKeyMan()->cs_KeyStore); BOOST_CHECK(keystore.GetLegacyScriptPubKeyMan()->AddKey(uncompressedKey)); - scriptPubKey = GetScriptForDestination(WitnessV0KeyHash(PKHash(uncompressedPubkey))); + scriptPubKey = GetScriptForDestination(WitnessV0KeyHash(uncompressedPubkey)); // Keystore has key, but no P2SH redeemScript result = keystore.GetLegacyScriptPubKeyMan()->IsMine(scriptPubKey); |