mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-03 09:56:38 -05:00
test: Move doxygen comment to header
Also, unrelated formatting fixups. Can be reviewed with --word-diff-regex=.
This commit is contained in:
parent
d254e6e795
commit
fa96574b0d
2 changed files with 15 additions and 18 deletions
|
@ -204,27 +204,24 @@ TestChain100Setup::TestChain100Setup()
|
|||
|
||||
// Generate a 100-block chain:
|
||||
coinbaseKey.MakeNewKey(true);
|
||||
CScript scriptPubKey = CScript() << ToByteVector(coinbaseKey.GetPubKey()) << OP_CHECKSIG;
|
||||
for (int i = 0; i < COINBASE_MATURITY; i++)
|
||||
{
|
||||
CScript scriptPubKey = CScript() << ToByteVector(coinbaseKey.GetPubKey()) << OP_CHECKSIG;
|
||||
for (int i = 0; i < COINBASE_MATURITY; i++) {
|
||||
std::vector<CMutableTransaction> noTxns;
|
||||
CBlock b = CreateAndProcessBlock(noTxns, scriptPubKey);
|
||||
m_coinbase_txns.push_back(b.vtx[0]);
|
||||
}
|
||||
}
|
||||
|
||||
// Create a new block with just given transactions, coinbase paying to
|
||||
// scriptPubKey, and try to add it to the current chain.
|
||||
CBlock TestChain100Setup::CreateAndProcessBlock(const std::vector<CMutableTransaction>& txns, const CScript& scriptPubKey)
|
||||
{
|
||||
const CChainParams& chainparams = Params();
|
||||
std::unique_ptr<CBlockTemplate> pblocktemplate = BlockAssembler(*m_node.mempool, chainparams).CreateNewBlock(scriptPubKey);
|
||||
CBlock& block = pblocktemplate->block;
|
||||
CBlock block = BlockAssembler(*m_node.mempool, chainparams).CreateNewBlock(scriptPubKey)->block;
|
||||
|
||||
// Replace mempool-selected txns with just coinbase plus passed-in txns:
|
||||
block.vtx.resize(1);
|
||||
for (const CMutableTransaction& tx : txns)
|
||||
for (const CMutableTransaction& tx : txns) {
|
||||
block.vtx.push_back(MakeTransactionRef(tx));
|
||||
}
|
||||
// IncrementExtraNonce creates a valid coinbase and merkleRoot
|
||||
{
|
||||
LOCK(cs_main);
|
||||
|
@ -237,8 +234,7 @@ CBlock TestChain100Setup::CreateAndProcessBlock(const std::vector<CMutableTransa
|
|||
std::shared_ptr<const CBlock> shared_pblock = std::make_shared<const CBlock>(block);
|
||||
Assert(m_node.chainman)->ProcessNewBlock(chainparams, shared_pblock, true, nullptr);
|
||||
|
||||
CBlock result = block;
|
||||
return result;
|
||||
return block;
|
||||
}
|
||||
|
||||
TestChain100Setup::~TestChain100Setup()
|
||||
|
@ -246,8 +242,8 @@ TestChain100Setup::~TestChain100Setup()
|
|||
gArgs.ForceSetArg("-segwitheight", "0");
|
||||
}
|
||||
|
||||
|
||||
CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CMutableTransaction &tx) {
|
||||
CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CMutableTransaction& tx)
|
||||
{
|
||||
return FromTx(MakeTransactionRef(tx));
|
||||
}
|
||||
|
||||
|
|
|
@ -102,15 +102,16 @@ class CBlock;
|
|||
struct CMutableTransaction;
|
||||
class CScript;
|
||||
|
||||
//
|
||||
// Testing fixture that pre-creates a
|
||||
// 100-block REGTEST-mode block chain
|
||||
//
|
||||
/**
|
||||
* Testing fixture that pre-creates a 100-block REGTEST-mode block chain
|
||||
*/
|
||||
struct TestChain100Setup : public RegTestingSetup {
|
||||
TestChain100Setup();
|
||||
|
||||
// Create a new block with just given transactions, coinbase paying to
|
||||
// scriptPubKey, and try to add it to the current chain.
|
||||
/**
|
||||
* Create a new block with just given transactions, coinbase paying to
|
||||
* scriptPubKey, and try to add it to the current chain.
|
||||
*/
|
||||
CBlock CreateAndProcessBlock(const std::vector<CMutableTransaction>& txns,
|
||||
const CScript& scriptPubKey);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue