aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/script/standard.h5
-rw-r--r--src/wallet/wallet.cpp2
2 files changed, 6 insertions, 1 deletions
diff --git a/src/script/standard.h b/src/script/standard.h
index e0defaf106..49a45f3eba 100644
--- a/src/script/standard.h
+++ b/src/script/standard.h
@@ -80,9 +80,14 @@ struct PKHash : public uint160
using uint160::uint160;
};
+struct WitnessV0KeyHash;
struct ScriptHash : public uint160
{
ScriptHash() : uint160() {}
+ // These don't do what you'd expect.
+ // Use ScriptHash(GetScriptForDestination(...)) instead.
+ explicit ScriptHash(const WitnessV0KeyHash& hash) = delete;
+ explicit ScriptHash(const PKHash& hash) = delete;
explicit ScriptHash(const uint160& hash) : uint160(hash) {}
explicit ScriptHash(const CScript& script);
using uint160::uint160;
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 12c37968ce..c30125e827 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -744,7 +744,7 @@ bool CWallet::IsUsedDestination(const uint256& hash, unsigned int n) const
if (GetDestData(wpkh_dest, "used", nullptr)) {
return true;
}
- ScriptHash sh_wpkh_dest(wpkh_dest);
+ ScriptHash sh_wpkh_dest(GetScriptForDestination(wpkh_dest));
if (GetDestData(sh_wpkh_dest, "used", nullptr)) {
return true;
}