Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/mining.cpp
Show First 20 Lines • Show All 239 Lines • ▼ Show 20 Lines | static UniValue generatetoaddress(const Config &config, | ||||
} | } | ||||
int nGenerate = request.params[0].get_int(); | int nGenerate = request.params[0].get_int(); | ||||
uint64_t nMaxTries = 1000000; | uint64_t nMaxTries = 1000000; | ||||
if (request.params.size() > 2) { | if (request.params.size() > 2) { | ||||
nMaxTries = request.params[2].get_int(); | nMaxTries = request.params[2].get_int(); | ||||
} | } | ||||
CBitcoinAddress address(request.params[1].get_str()); | CTxDestination destination = DecodeDestination(request.params[1].get_str()); | ||||
if (!address.IsValid()) { | if (!IsValidDestination(destination)) { | ||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | ||||
"Error: Invalid address"); | "Error: Invalid address"); | ||||
} | } | ||||
boost::shared_ptr<CReserveScript> coinbaseScript(new CReserveScript()); | boost::shared_ptr<CReserveScript> coinbaseScript(new CReserveScript()); | ||||
coinbaseScript->reserveScript = GetScriptForDestination(address.Get()); | coinbaseScript->reserveScript = GetScriptForDestination(destination); | ||||
return generateBlocks(config, coinbaseScript, nGenerate, nMaxTries, false); | return generateBlocks(config, coinbaseScript, nGenerate, nMaxTries, false); | ||||
} | } | ||||
static UniValue getmininginfo(const Config &config, | static UniValue getmininginfo(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 0) { | if (request.fHelp || request.params.size() != 0) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
▲ Show 20 Lines • Show All 834 Lines • Show Last 20 Lines |