aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Woosley <ben.woosley@gmail.com>2020-01-14 22:37:16 -0800
committerBen Woosley <ben.woosley@gmail.com>2020-06-19 12:14:06 -0700
commit0a5ea32ce605984094c5552877cb99bc81654f2c (patch)
treecb53980bce46fe9253638771e786be287122ceb4 /src
parentf3d776b59380ad31e8b3a2948364c7690eebe05d (diff)
Prefer explicit uint160 conversion
Diffstat (limited to 'src')
-rw-r--r--src/rpc/rawtransaction.cpp2
-rw-r--r--src/script/standard.cpp2
-rw-r--r--src/script/standard.h4
3 files changed, 2 insertions, 6 deletions
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp
index e14217c307..814f8bddfe 100644
--- a/src/rpc/rawtransaction.cpp
+++ b/src/rpc/rawtransaction.cpp
@@ -595,7 +595,7 @@ static UniValue decodescript(const JSONRPCRequest& request)
if (which_type == TX_PUBKEY) {
segwitScr = GetScriptForDestination(WitnessV0KeyHash(Hash160(solutions_data[0].begin(), solutions_data[0].end())));
} else if (which_type == TX_PUBKEYHASH) {
- segwitScr = GetScriptForDestination(WitnessV0KeyHash(solutions_data[0]));
+ segwitScr = GetScriptForDestination(WitnessV0KeyHash(uint160{solutions_data[0]}));
} else {
// Scripts that are not fit for P2WPKH are encoded as P2WSH.
// Newer segwit program versions should be considered when then become available.
diff --git a/src/script/standard.cpp b/src/script/standard.cpp
index d199a84cee..b6ee6117d9 100644
--- a/src/script/standard.cpp
+++ b/src/script/standard.cpp
@@ -307,7 +307,7 @@ CScript GetScriptForWitness(const CScript& redeemscript)
if (typ == TX_PUBKEY) {
return GetScriptForDestination(WitnessV0KeyHash(Hash160(vSolutions[0].begin(), vSolutions[0].end())));
} else if (typ == TX_PUBKEYHASH) {
- return GetScriptForDestination(WitnessV0KeyHash(vSolutions[0]));
+ return GetScriptForDestination(WitnessV0KeyHash(uint160{vSolutions[0]}));
}
return GetScriptForDestination(WitnessV0ScriptHash(redeemscript));
}
diff --git a/src/script/standard.h b/src/script/standard.h
index 2929425670..c1a9fc90bd 100644
--- a/src/script/standard.h
+++ b/src/script/standard.h
@@ -78,7 +78,6 @@ struct PKHash : public uint160
PKHash() : uint160() {}
explicit PKHash(const uint160& hash) : uint160(hash) {}
explicit PKHash(const CPubKey& pubkey);
- using uint160::uint160;
};
struct WitnessV0KeyHash;
@@ -91,7 +90,6 @@ struct ScriptHash : public uint160
explicit ScriptHash(const PKHash& hash) = delete;
explicit ScriptHash(const uint160& hash) : uint160(hash) {}
explicit ScriptHash(const CScript& script);
- using uint160::uint160;
};
struct WitnessV0ScriptHash : public uint256
@@ -99,14 +97,12 @@ struct WitnessV0ScriptHash : public uint256
WitnessV0ScriptHash() : uint256() {}
explicit WitnessV0ScriptHash(const uint256& hash) : uint256(hash) {}
explicit WitnessV0ScriptHash(const CScript& script);
- using uint256::uint256;
};
struct WitnessV0KeyHash : public uint160
{
WitnessV0KeyHash() : uint160() {}
explicit WitnessV0KeyHash(const uint160& hash) : uint160(hash) {}
- using uint160::uint160;
};
//! CTxDestination subtype to encode any future Witness version