Skip to content

Commit fa96574

Browse files
author
MarcoFalke
committed
test: Move doxygen comment to header
Also, unrelated formatting fixups. Can be reviewed with --word-diff-regex=.
1 parent d254e6e commit fa96574

File tree

2 files changed

+15
-18
lines changed

2 files changed

+15
-18
lines changed

src/test/util/setup_common.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
218215
CBlock 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

244240
TestChain100Setup::~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

src/test/util/setup_common.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,16 @@ class CBlock;
102102
struct CMutableTransaction;
103103
class CScript;
104104

105-
//
106-
// Testing fixture that pre-creates a
107-
// 100-block REGTEST-mode block chain
108-
//
105+
/**
106+
* Testing fixture that pre-creates a 100-block REGTEST-mode block chain
107+
*/
109108
struct TestChain100Setup : public RegTestingSetup {
110109
TestChain100Setup();
111110

112-
// Create a new block with just given transactions, coinbase paying to
113-
// scriptPubKey, and try to add it to the current chain.
111+
/**
112+
* Create a new block with just given transactions, coinbase paying to
113+
* scriptPubKey, and try to add it to the current chain.
114+
*/
114115
CBlock CreateAndProcessBlock(const std::vector<CMutableTransaction>& txns,
115116
const CScript& scriptPubKey);
116117

0 commit comments

Comments
 (0)