aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2018-06-17 19:44:50 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2018-06-17 19:44:50 -0700
commitbb582a59c7532b0e4f647d9dfe50f0d816e81427 (patch)
tree4961859632aa54894a57b87cdde4af6e2bb08c86 /src/wallet
parenteaba1c111e9671cdd6faf4b96c39341bbdd41632 (diff)
Add P2WSH destination helper and use it instead of manual hashing
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index f55c2262e6..18e64ebc53 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -4520,9 +4520,7 @@ CTxDestination CWallet::AddAndGetDestinationForScript(const CScript& script, Out
return CScriptID(script);
case OutputType::P2SH_SEGWIT:
case OutputType::BECH32: {
- WitnessV0ScriptHash hash;
- CSHA256().Write(script.data(), script.size()).Finalize(hash.begin());
- CTxDestination witdest = hash;
+ CTxDestination witdest = WitnessV0ScriptHash(script);
CScript witprog = GetScriptForDestination(witdest);
// Check if the resulting program is solvable (i.e. doesn't use an uncompressed key)
if (!IsSolvable(*this, witprog)) return CScriptID(script);