@@ -204,27 +204,24 @@ TestChain100Setup::TestChain100Setup()
204204
205205 // Generate a 100-block chain:
206206 coinbaseKey.MakeNewKey (true );
207- CScript scriptPubKey = CScript () << ToByteVector (coinbaseKey.GetPubKey ()) << OP_CHECKSIG;
208- for (int i = 0 ; i < COINBASE_MATURITY; i++)
209- {
207+ CScript scriptPubKey = CScript () << ToByteVector (coinbaseKey.GetPubKey ()) << OP_CHECKSIG;
208+ for (int i = 0 ; i < COINBASE_MATURITY; i++) {
210209 std::vector<CMutableTransaction> noTxns;
211210 CBlock b = CreateAndProcessBlock (noTxns, scriptPubKey);
212211 m_coinbase_txns.push_back (b.vtx [0 ]);
213212 }
214213}
215214
216- // Create a new block with just given transactions, coinbase paying to
217- // scriptPubKey, and try to add it to the current chain.
218215CBlock TestChain100Setup::CreateAndProcessBlock (const std::vector<CMutableTransaction>& txns, const CScript& scriptPubKey)
219216{
220217 const CChainParams& chainparams = Params ();
221- std::unique_ptr<CBlockTemplate> pblocktemplate = BlockAssembler (*m_node.mempool , chainparams).CreateNewBlock (scriptPubKey);
222- CBlock& block = pblocktemplate->block ;
218+ CBlock block = BlockAssembler (*m_node.mempool , chainparams).CreateNewBlock (scriptPubKey)->block ;
223219
224220 // Replace mempool-selected txns with just coinbase plus passed-in txns:
225221 block.vtx .resize (1 );
226- for (const CMutableTransaction& tx : txns)
222+ for (const CMutableTransaction& tx : txns) {
227223 block.vtx .push_back (MakeTransactionRef (tx));
224+ }
228225 // IncrementExtraNonce creates a valid coinbase and merkleRoot
229226 {
230227 LOCK (cs_main);
@@ -237,17 +234,16 @@ CBlock TestChain100Setup::CreateAndProcessBlock(const std::vector<CMutableTransa
237234 std::shared_ptr<const CBlock> shared_pblock = std::make_shared<const CBlock>(block);
238235 Assert (m_node.chainman )->ProcessNewBlock (chainparams, shared_pblock, true , nullptr );
239236
240- CBlock result = block;
241- return result;
237+ return block;
242238}
243239
244240TestChain100Setup::~TestChain100Setup ()
245241{
246242 gArgs .ForceSetArg (" -segwitheight" , " 0" );
247243}
248244
249-
250- CTxMemPoolEntry TestMemPoolEntryHelper::FromTx ( const CMutableTransaction &tx) {
245+ CTxMemPoolEntry TestMemPoolEntryHelper::FromTx ( const CMutableTransaction& tx)
246+ {
251247 return FromTx (MakeTransactionRef (tx));
252248}
253249
0 commit comments