Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/misc.cpp
// Copyright (c) 2010 Satoshi Nakamoto | // Copyright (c) 2010 Satoshi Nakamoto | ||||
// Copyright (c) 2009-2016 The Bitcoin Core developers | // Copyright (c) 2009-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <chain.h> | #include <chain.h> | ||||
#include <clientversion.h> | #include <clientversion.h> | ||||
#include <config.h> | #include <config.h> | ||||
#include <core_io.h> | #include <core_io.h> | ||||
#include <httpserver.h> | #include <httpserver.h> | ||||
#include <init.h> | #include <init.h> | ||||
#include <key_io.h> | #include <key_io.h> | ||||
#include <logging.h> | #include <logging.h> | ||||
#include <net.h> | #include <net.h> | ||||
#include <netbase.h> | #include <netbase.h> | ||||
#include <outputtype.h> | |||||
#include <rpc/blockchain.h> | #include <rpc/blockchain.h> | ||||
#include <rpc/misc.h> | #include <rpc/misc.h> | ||||
#include <rpc/server.h> | #include <rpc/server.h> | ||||
#include <rpc/util.h> | #include <rpc/util.h> | ||||
#include <timedata.h> | #include <timedata.h> | ||||
#include <util/strencodings.h> | #include <util/strencodings.h> | ||||
#include <util/system.h> | #include <util/system.h> | ||||
#include <validation.h> | #include <validation.h> | ||||
▲ Show 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | for (size_t i = 0; i < keys.size(); ++i) { | ||||
pubkeys.push_back(HexToPubKey(keys[i].get_str())); | pubkeys.push_back(HexToPubKey(keys[i].get_str())); | ||||
} else { | } else { | ||||
throw JSONRPCError( | throw JSONRPCError( | ||||
RPC_INVALID_ADDRESS_OR_KEY, | RPC_INVALID_ADDRESS_OR_KEY, | ||||
strprintf("Invalid public key: %s\n", keys[i].get_str())); | strprintf("Invalid public key: %s\n", keys[i].get_str())); | ||||
} | } | ||||
} | } | ||||
// Get the output type | |||||
OutputType output_type = OutputType::LEGACY; | |||||
// Construct using pay-to-script-hash: | // Construct using pay-to-script-hash: | ||||
CScript inner = CreateMultisigRedeemscript(required, pubkeys); | const CScript inner = CreateMultisigRedeemscript(required, pubkeys); | ||||
CScriptID innerID(inner); | CBasicKeyStore keystore; | ||||
const CTxDestination dest = | |||||
AddAndGetDestinationForScript(keystore, inner, output_type); | |||||
UniValue result(UniValue::VOBJ); | UniValue result(UniValue::VOBJ); | ||||
result.pushKV("address", EncodeDestination(innerID, config)); | result.pushKV("address", EncodeDestination(dest, config)); | ||||
result.pushKV("redeemScript", HexStr(inner.begin(), inner.end())); | result.pushKV("redeemScript", HexStr(inner.begin(), inner.end())); | ||||
return result; | return result; | ||||
} | } | ||||
static UniValue verifymessage(const Config &config, | static UniValue verifymessage(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 3) { | if (request.fHelp || request.params.size() != 3) { | ||||
▲ Show 20 Lines • Show All 389 Lines • Show Last 20 Lines |