Skip to content

Commit 0a5ea32

Browse files
committed
Prefer explicit uint160 conversion
1 parent f3d776b commit 0a5ea32

File tree

3 files changed

+2
-6
lines changed

3 files changed

+2
-6
lines changed

src/rpc/rawtransaction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ static UniValue decodescript(const JSONRPCRequest& request)
595595
if (which_type == TX_PUBKEY) {
596596
segwitScr = GetScriptForDestination(WitnessV0KeyHash(Hash160(solutions_data[0].begin(), solutions_data[0].end())));
597597
} else if (which_type == TX_PUBKEYHASH) {
598-
segwitScr = GetScriptForDestination(WitnessV0KeyHash(solutions_data[0]));
598+
segwitScr = GetScriptForDestination(WitnessV0KeyHash(uint160{solutions_data[0]}));
599599
} else {
600600
// Scripts that are not fit for P2WPKH are encoded as P2WSH.
601601
// Newer segwit program versions should be considered when then become available.

src/script/standard.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ CScript GetScriptForWitness(const CScript& redeemscript)
307307
if (typ == TX_PUBKEY) {
308308
return GetScriptForDestination(WitnessV0KeyHash(Hash160(vSolutions[0].begin(), vSolutions[0].end())));
309309
} else if (typ == TX_PUBKEYHASH) {
310-
return GetScriptForDestination(WitnessV0KeyHash(vSolutions[0]));
310+
return GetScriptForDestination(WitnessV0KeyHash(uint160{vSolutions[0]}));
311311
}
312312
return GetScriptForDestination(WitnessV0ScriptHash(redeemscript));
313313
}

src/script/standard.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ struct PKHash : public uint160
7878
PKHash() : uint160() {}
7979
explicit PKHash(const uint160& hash) : uint160(hash) {}
8080
explicit PKHash(const CPubKey& pubkey);
81-
using uint160::uint160;
8281
};
8382

8483
struct WitnessV0KeyHash;
@@ -91,22 +90,19 @@ struct ScriptHash : public uint160
9190
explicit ScriptHash(const PKHash& hash) = delete;
9291
explicit ScriptHash(const uint160& hash) : uint160(hash) {}
9392
explicit ScriptHash(const CScript& script);
94-
using uint160::uint160;
9593
};
9694

9795
struct WitnessV0ScriptHash : public uint256
9896
{
9997
WitnessV0ScriptHash() : uint256() {}
10098
explicit WitnessV0ScriptHash(const uint256& hash) : uint256(hash) {}
10199
explicit WitnessV0ScriptHash(const CScript& script);
102-
using uint256::uint256;
103100
};
104101

105102
struct WitnessV0KeyHash : public uint160
106103
{
107104
WitnessV0KeyHash() : uint160() {}
108105
explicit WitnessV0KeyHash(const uint160& hash) : uint160(hash) {}
109-
using uint160::uint160;
110106
};
111107

112108
//! CTxDestination subtype to encode any future Witness version

0 commit comments

Comments
 (0)