16
16
#include < policy/fees.h>
17
17
#include < pow.h>
18
18
#include < rpc/blockchain.h>
19
- #include < rpc/mining.h>
20
19
#include < rpc/server.h>
21
20
#include < rpc/util.h>
21
+ #include < script/script.h>
22
22
#include < shutdown.h>
23
23
#include < txmempool.h>
24
+ #include < univalue.h>
24
25
#include < util/fees.h>
25
26
#include < util/strencodings.h>
26
27
#include < util/system.h>
@@ -100,7 +101,7 @@ static UniValue getnetworkhashps(const JSONRPCRequest& request)
100
101
return GetNetworkHashPS (!request.params [0 ].isNull () ? request.params [0 ].get_int () : 120 , !request.params [1 ].isNull () ? request.params [1 ].get_int () : -1 );
101
102
}
102
103
103
- UniValue generateBlocks (std::shared_ptr<CReserveScript> coinbaseScript , int nGenerate, uint64_t nMaxTries, bool keepScript )
104
+ static UniValue generateBlocks (const CScript& coinbase_script , int nGenerate, uint64_t nMaxTries)
104
105
{
105
106
static const int nInnerLoopCount = 0x10000 ;
106
107
int nHeightEnd = 0 ;
@@ -115,7 +116,7 @@ UniValue generateBlocks(std::shared_ptr<CReserveScript> coinbaseScript, int nGen
115
116
UniValue blockHashes (UniValue::VARR);
116
117
while (nHeight < nHeightEnd && !ShutdownRequested ())
117
118
{
118
- std::unique_ptr<CBlockTemplate> pblocktemplate (BlockAssembler (Params ()).CreateNewBlock (coinbaseScript-> reserveScript ));
119
+ std::unique_ptr<CBlockTemplate> pblocktemplate (BlockAssembler (Params ()).CreateNewBlock (coinbase_script ));
119
120
if (!pblocktemplate.get ())
120
121
throw JSONRPCError (RPC_INTERNAL_ERROR, " Couldn't create new block" );
121
122
CBlock *pblock = &pblocktemplate->block ;
@@ -138,12 +139,6 @@ UniValue generateBlocks(std::shared_ptr<CReserveScript> coinbaseScript, int nGen
138
139
throw JSONRPCError (RPC_INTERNAL_ERROR, " ProcessNewBlock, block not accepted" );
139
140
++nHeight;
140
141
blockHashes.push_back (pblock->GetHash ().GetHex ());
141
-
142
- // mark script as important because it was used at least for one coinbase output if the script came from the wallet
143
- if (keepScript)
144
- {
145
- coinbaseScript->KeepScript ();
146
- }
147
142
}
148
143
return blockHashes;
149
144
}
@@ -181,10 +176,9 @@ static UniValue generatetoaddress(const JSONRPCRequest& request)
181
176
throw JSONRPCError (RPC_INVALID_ADDRESS_OR_KEY, " Error: Invalid address" );
182
177
}
183
178
184
- std::shared_ptr<CReserveScript> coinbaseScript = std::make_shared<CReserveScript>();
185
- coinbaseScript->reserveScript = GetScriptForDestination (destination);
179
+ CScript coinbase_script = GetScriptForDestination (destination);
186
180
187
- return generateBlocks (coinbaseScript , nGenerate, nMaxTries, false );
181
+ return generateBlocks (coinbase_script , nGenerate, nMaxTries);
188
182
}
189
183
190
184
static UniValue getmininginfo (const JSONRPCRequest& request)
0 commit comments