Prefer explicit uint160 conversion
This commit is contained in:
parent
f3d776b593
commit
0a5ea32ce6
3 changed files with 2 additions and 6 deletions
|
@ -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.
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue