Skip to content

Commit 2aaff48

Browse files
author
MarcoFalke
committed
Merge #19283: refactor: Remove unused BlockAssembler::pblock member var
fa6d5ab refactor: Remove unused BlockAssembler::pblock member var (MarcoFalke) Pull request description: It seems odd to have a confusing and fragile "convenience pointer" member variable to be able to write `pblock->vtx` instead of `pblocktemplate->block.vtx` in a single place. ACKs for top commit: promag: Code review ACK fa6d5ab. Tree-SHA512: e9f032b5ab702dbefffd370db3768ebfb95c13acc732972b695281ea34c91d70cd0a1700bc2c6f106dbc9de68e81bc6bb06c68c2afd53c17cba8ebee4f9931b9
2 parents fd9db45 + fa6d5ab commit 2aaff48

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/miner.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& sc
109109

110110
if(!pblocktemplate.get())
111111
return nullptr;
112-
pblock = &pblocktemplate->block; // pointer for convenience
112+
CBlock* const pblock = &pblocktemplate->block; // pointer for convenience
113113

114114
// Add dummy coinbase tx as first transaction
115115
pblock->vtx.emplace_back();
@@ -226,7 +226,7 @@ bool BlockAssembler::TestPackageTransactions(const CTxMemPool::setEntries& packa
226226

227227
void BlockAssembler::AddToBlock(CTxMemPool::txiter iter)
228228
{
229-
pblock->vtx.emplace_back(iter->GetSharedTx());
229+
pblocktemplate->block.vtx.emplace_back(iter->GetSharedTx());
230230
pblocktemplate->vTxFees.push_back(iter->GetFee());
231231
pblocktemplate->vTxSigOpsCost.push_back(iter->GetSigOpCost());
232232
nBlockWeight += iter->GetTxWeight();

src/miner.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,6 @@ class BlockAssembler
128128
private:
129129
// The constructed block template
130130
std::unique_ptr<CBlockTemplate> pblocktemplate;
131-
// A convenience pointer that always refers to the CBlock in pblocktemplate
132-
CBlock* pblock;
133131

134132
// Configuration parameters for the block size
135133
bool fIncludeWitness;

0 commit comments

Comments
 (0)