aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2019-05-09 18:04:52 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2019-05-09 18:54:43 +0200
commitde5af41e3567dd9660b3e9734113dccbce394207 (patch)
treee54113730410592e361e1910b08232c578696acf /src/rpc
parentaebe990dfeb41bcd022a44db28fbedd435d2f433 (diff)
parent78e407ad0c26190a22de1bc8ed900164a44a36c3 (diff)
downloadbitcoin-de5af41e3567dd9660b3e9734113dccbce394207.tar.xz
Merge #15452: Replace CScriptID and CKeyID in CTxDestination with dedicated types
78e407ad0c26190a22de1bc8ed900164a44a36c3 GetKeyBirthTimes should return key ids, not destinations (Gregory Sanders) 70946e7fee54323ce6a5ea8aeb377e2c7c790bc6 Replace CScriptID and CKeyID in CTxDestination with dedicated types (Gregory Sanders) Pull request description: The current usage seems to be an overloading of meanings. `CScriptID` is used in the wallet as a lookup key, as well as a destination, and `CKeyID` likewise. Instead, have all destinations be dedicated types. New types: `CScriptID`->`ScriptHash` `CKeyID`->`PKHash` ACKs for commit 78e407: ryanofsky: utACK 78e407ad0c26190a22de1bc8ed900164a44a36c3. Only changes are removing extra CScriptID()s and fixing the test case. Sjors: utACK 78e407a meshcollider: utACK https://github.com/bitcoin/bitcoin/pull/15452/commits/78e407ad0c26190a22de1bc8ed900164a44a36c3 Tree-SHA512: 437f59fc3afb83a40540da3351507aef5aed44e3a7f15b01ddad6226854edeee762ff0b0ef336fe3654c4cd99a205cef175211de8b639abe1130c8a6313337b9
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/misc.cpp6
-rw-r--r--src/rpc/rawtransaction.cpp4
-rw-r--r--src/rpc/util.cpp4
3 files changed, 7 insertions, 7 deletions
diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp
index bfb559f0db..7327d6a1b0 100644
--- a/src/rpc/misc.cpp
+++ b/src/rpc/misc.cpp
@@ -307,8 +307,8 @@ static UniValue verifymessage(const JSONRPCRequest& request)
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid address");
}
- const CKeyID *keyID = boost::get<CKeyID>(&destination);
- if (!keyID) {
+ const PKHash *pkhash = boost::get<PKHash>(&destination);
+ if (!pkhash) {
throw JSONRPCError(RPC_TYPE_ERROR, "Address does not refer to key");
}
@@ -326,7 +326,7 @@ static UniValue verifymessage(const JSONRPCRequest& request)
if (!pubkey.RecoverCompact(ss.GetHash(), vchSig))
return false;
- return (pubkey.GetID() == *keyID);
+ return (pubkey.GetID() == *pkhash);
}
static UniValue signmessagewithprivkey(const JSONRPCRequest& request)
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp
index 0a820af114..b3926786db 100644
--- a/src/rpc/rawtransaction.cpp
+++ b/src/rpc/rawtransaction.cpp
@@ -572,7 +572,7 @@ static UniValue decodescript(const JSONRPCRequest& request)
if (type.isStr() && type.get_str() != "scripthash") {
// P2SH cannot be wrapped in a P2SH. If this script is already a P2SH,
// don't return the address for a P2SH of the P2SH.
- r.pushKV("p2sh", EncodeDestination(CScriptID(script)));
+ r.pushKV("p2sh", EncodeDestination(ScriptHash(script)));
// P2SH and witness programs cannot be wrapped in P2WSH, if this script
// is a witness program, don't return addresses for a segwit programs.
if (type.get_str() == "pubkey" || type.get_str() == "pubkeyhash" || type.get_str() == "multisig" || type.get_str() == "nonstandard") {
@@ -599,7 +599,7 @@ static UniValue decodescript(const JSONRPCRequest& request)
segwitScr = GetScriptForDestination(WitnessV0ScriptHash(script));
}
ScriptPubKeyToUniv(segwitScr, sr, /* fIncludeHex */ true);
- sr.pushKV("p2sh-segwit", EncodeDestination(CScriptID(segwitScr)));
+ sr.pushKV("p2sh-segwit", EncodeDestination(ScriptHash(segwitScr)));
r.pushKV("segwit", sr);
}
}
diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp
index 1a87c9f935..e329ff7e46 100644
--- a/src/rpc/util.cpp
+++ b/src/rpc/util.cpp
@@ -181,7 +181,7 @@ public:
return UniValue(UniValue::VOBJ);
}
- UniValue operator()(const CKeyID& keyID) const
+ UniValue operator()(const PKHash& keyID) const
{
UniValue obj(UniValue::VOBJ);
obj.pushKV("isscript", false);
@@ -189,7 +189,7 @@ public:
return obj;
}
- UniValue operator()(const CScriptID& scriptID) const
+ UniValue operator()(const ScriptHash& scriptID) const
{
UniValue obj(UniValue::VOBJ);
obj.pushKV("isscript", true);