mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-03 17:54:19 +02:00
refactor: Use CPubKey vector constructor where possible
This commit is contained in:
@@ -469,7 +469,7 @@ RPCHelpMan importpubkey()
|
||||
if (!IsHex(request.params[0].get_str()))
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Pubkey must be a hex string");
|
||||
std::vector<unsigned char> data(ParseHex(request.params[0].get_str()));
|
||||
CPubKey pubKey(data.begin(), data.end());
|
||||
CPubKey pubKey(data);
|
||||
if (!pubKey.IsFullyValid())
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Pubkey is not a valid public key");
|
||||
|
||||
@@ -871,7 +871,7 @@ static std::string RecurseImportData(const CScript& script, ImportData& import_d
|
||||
|
||||
switch (script_type) {
|
||||
case TxoutType::PUBKEY: {
|
||||
CPubKey pubkey(solverdata[0].begin(), solverdata[0].end());
|
||||
CPubKey pubkey(solverdata[0]);
|
||||
import_data.used_keys.emplace(pubkey.GetID(), false);
|
||||
return "";
|
||||
}
|
||||
@@ -893,7 +893,7 @@ static std::string RecurseImportData(const CScript& script, ImportData& import_d
|
||||
}
|
||||
case TxoutType::MULTISIG: {
|
||||
for (size_t i = 1; i + 1< solverdata.size(); ++i) {
|
||||
CPubKey pubkey(solverdata[i].begin(), solverdata[i].end());
|
||||
CPubKey pubkey(solverdata[i]);
|
||||
import_data.used_keys.emplace(pubkey.GetID(), false);
|
||||
}
|
||||
return "";
|
||||
@@ -997,7 +997,7 @@ static UniValue ProcessImportLegacy(ImportData& import_data, std::map<CKeyID, CP
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Pubkey \"" + str + "\" must be a hex string");
|
||||
}
|
||||
auto parsed_pubkey = ParseHex(str);
|
||||
CPubKey pubkey(parsed_pubkey.begin(), parsed_pubkey.end());
|
||||
CPubKey pubkey(parsed_pubkey);
|
||||
if (!pubkey.IsFullyValid()) {
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Pubkey \"" + str + "\" is not a valid public key");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user