mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
Merge adc55dbac5 into merged_master (Bitcoin PR #15748)
This commit is contained in:
commit
8597b2f437
6 changed files with 7 additions and 40 deletions
|
|
@ -17,11 +17,12 @@
|
|||
#include <policy/settings.h>
|
||||
#include <pow.h>
|
||||
#include <rpc/blockchain.h>
|
||||
#include <rpc/mining.h>
|
||||
#include <rpc/server.h>
|
||||
#include <rpc/util.h>
|
||||
#include <script/script.h>
|
||||
#include <shutdown.h>
|
||||
#include <txmempool.h>
|
||||
#include <univalue.h>
|
||||
#include <util/fees.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <util/system.h>
|
||||
|
|
@ -107,7 +108,7 @@ static UniValue getnetworkhashps(const JSONRPCRequest& request)
|
|||
return GetNetworkHashPS(!request.params[0].isNull() ? request.params[0].get_int() : 120, !request.params[1].isNull() ? request.params[1].get_int() : -1);
|
||||
}
|
||||
|
||||
UniValue generateBlocks(std::shared_ptr<CReserveScript> coinbaseScript, int nGenerate, uint64_t nMaxTries, bool keepScript)
|
||||
static UniValue generateBlocks(const CScript& coinbase_script, int nGenerate, uint64_t nMaxTries)
|
||||
{
|
||||
static const int nInnerLoopCount = 0x10000;
|
||||
int nHeightEnd = 0;
|
||||
|
|
@ -122,7 +123,7 @@ UniValue generateBlocks(std::shared_ptr<CReserveScript> coinbaseScript, int nGen
|
|||
UniValue blockHashes(UniValue::VARR);
|
||||
while (nHeight < nHeightEnd && !ShutdownRequested())
|
||||
{
|
||||
std::unique_ptr<CBlockTemplate> pblocktemplate(BlockAssembler(Params()).CreateNewBlock(coinbaseScript->reserveScript));
|
||||
std::unique_ptr<CBlockTemplate> pblocktemplate(BlockAssembler(Params()).CreateNewBlock(coinbase_script));
|
||||
if (!pblocktemplate.get())
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Couldn't create new block");
|
||||
CBlock *pblock = &pblocktemplate->block;
|
||||
|
|
@ -149,12 +150,6 @@ UniValue generateBlocks(std::shared_ptr<CReserveScript> coinbaseScript, int nGen
|
|||
throw JSONRPCError(RPC_INTERNAL_ERROR, "ProcessNewBlock, block not accepted");
|
||||
++nHeight;
|
||||
blockHashes.push_back(pblock->GetHash().GetHex());
|
||||
|
||||
//mark script as important because it was used at least for one coinbase output if the script came from the wallet
|
||||
if (keepScript)
|
||||
{
|
||||
coinbaseScript->KeepScript();
|
||||
}
|
||||
}
|
||||
return blockHashes;
|
||||
}
|
||||
|
|
@ -192,10 +187,9 @@ static UniValue generatetoaddress(const JSONRPCRequest& request)
|
|||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Error: Invalid address");
|
||||
}
|
||||
|
||||
std::shared_ptr<CReserveScript> coinbaseScript = std::make_shared<CReserveScript>();
|
||||
coinbaseScript->reserveScript = GetScriptForDestination(destination);
|
||||
CScript coinbase_script = GetScriptForDestination(destination);
|
||||
|
||||
return generateBlocks(coinbaseScript, nGenerate, nMaxTries, false);
|
||||
return generateBlocks(coinbase_script, nGenerate, nMaxTries);
|
||||
}
|
||||
|
||||
static UniValue getmininginfo(const JSONRPCRequest& request)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue