mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 23:03:45 +01:00
Merge #17938: Disallow automatic conversion between disparate hash types
4d7369125aDisallow automatic conversion between hash types (Ben Woosley)fa9ef2cdbeRemove an apparently unnecessary conversion (Ben Woosley)966a22d859Explicitly support conversion between equivalent hash types (Ben Woosley)f32c1e07fdUse explicit conversion from WitnessV0KeyHash -> CKeyID (Ben Woosley)2c54217f91Use explicit conversion from PKHash -> CKeyID (Ben Woosley)a9e451f144Convert CPubKey to WitnessV0KeyHash directly (Ben Woosley)3fcc468123Prefer explicit CScriptID construction (Ben Woosley)0a5ea32ce6Prefer explicit uint160 conversion (Ben Woosley) Pull request description: This bases the script/standard hash types, TxDestination-related and CScriptID on a base template which does not silently convert the underlying `uintN` type. Inspired by and built on #17924. Commits are small and focused to ease review. Note some of these changes may be relative to existing bugs of the same sort as #17924. See particularly "Convert CPubKey to WitnessV0KeyHash directly" and "Remove an apparently unnecessary conversion". ACKs for top commit: achow101: ACK4d7369125ameshcollider: re-utACK4d7369125aTree-SHA512: f1b3284ddc6fb6c6e726f2c22668b6d732d45eb5418262ed2b9c728f60be7be43dfb414b6ddd9915025c8dcd7f360dc3b46e997a945a2feb95b0e5c4f05d6b54
This commit is contained in:
@@ -3517,7 +3517,7 @@ public:
|
||||
|
||||
UniValue operator()(const PKHash& pkhash) const
|
||||
{
|
||||
CKeyID keyID(pkhash);
|
||||
CKeyID keyID{ToKeyID(pkhash)};
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
CPubKey vchPubKey;
|
||||
if (provider && provider->GetPubKey(keyID, vchPubKey)) {
|
||||
@@ -3542,7 +3542,7 @@ public:
|
||||
{
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
CPubKey pubkey;
|
||||
if (provider && provider->GetPubKey(CKeyID(id), pubkey)) {
|
||||
if (provider && provider->GetPubKey(ToKeyID(id), pubkey)) {
|
||||
obj.pushKV("pubkey", HexStr(pubkey));
|
||||
}
|
||||
return obj;
|
||||
|
||||
Reference in New Issue
Block a user