mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
Introduce wrappers around CBitcoinAddress
This patch removes the need for the intermediary Base58 type
CBitcoinAddress, by providing {Encode,Decode,IsValid}Destination
function that directly operate on the conversion between strings
and CTxDestination.
This commit is contained in:
parent
6866b4912b
commit
5c8ff0d448
26 changed files with 299 additions and 277 deletions
|
|
@ -176,12 +176,13 @@ UniValue generatetoaddress(const JSONRPCRequest& request)
|
|||
nMaxTries = request.params[2].get_int();
|
||||
}
|
||||
|
||||
CBitcoinAddress address(request.params[1].get_str());
|
||||
if (!address.IsValid())
|
||||
CTxDestination destination = DecodeDestination(request.params[1].get_str());
|
||||
if (!IsValidDestination(destination)) {
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Error: Invalid address");
|
||||
}
|
||||
|
||||
std::shared_ptr<CReserveScript> coinbaseScript = std::make_shared<CReserveScript>();
|
||||
coinbaseScript->reserveScript = GetScriptForDestination(address.Get());
|
||||
coinbaseScript->reserveScript = GetScriptForDestination(destination);
|
||||
|
||||
return generateBlocks(coinbaseScript, nGenerate, nMaxTries, false);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue