Skip to content

Commit e62067e

Browse files
committed
Revert "miner: Pass in chainstate to BlockAssembler::CreateNewBlock"
This reverts commit d0de61b.
1 parent eede064 commit e62067e

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

src/miner.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,6 @@ void BlockAssembler::resetBlock()
9797
}
9898

9999
std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn)
100-
{
101-
return CreateNewBlock(::ChainstateActive(), scriptPubKeyIn);
102-
}
103-
104-
std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(CChainState& chainstate, const CScript& scriptPubKeyIn)
105100
{
106101
int64_t nTimeStart = GetTimeMicros();
107102

@@ -119,8 +114,7 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(CChainState& chai
119114
pblocktemplate->vTxSigOpsCost.push_back(-1); // updated at end
120115

121116
LOCK2(cs_main, m_mempool.cs);
122-
assert(std::addressof(*::ChainActive().Tip()) == std::addressof(*chainstate.m_chain.Tip()));
123-
CBlockIndex* pindexPrev = chainstate.m_chain.Tip();
117+
CBlockIndex* pindexPrev = ::ChainActive().Tip();
124118
assert(pindexPrev != nullptr);
125119
nHeight = pindexPrev->nHeight + 1;
126120

@@ -179,8 +173,7 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(CChainState& chai
179173
pblocktemplate->vTxSigOpsCost[0] = WITNESS_SCALE_FACTOR * GetLegacySigOpCount(*pblock->vtx[0]);
180174

181175
BlockValidationState state;
182-
assert(std::addressof(::ChainstateActive()) == std::addressof(chainstate));
183-
if (!TestBlockValidity(state, chainparams, chainstate, *pblock, pindexPrev, false, false)) {
176+
if (!TestBlockValidity(state, chainparams, ::ChainstateActive(), *pblock, pindexPrev, false, false)) {
184177
throw std::runtime_error(strprintf("%s: TestBlockValidity failed: %s", __func__, state.ToString()));
185178
}
186179
int64_t nTime2 = GetTimeMicros();

src/miner.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ class BlockAssembler
159159

160160
/** Construct a new block template with coinbase to scriptPubKeyIn */
161161
std::unique_ptr<CBlockTemplate> CreateNewBlock(const CScript& scriptPubKeyIn);
162-
std::unique_ptr<CBlockTemplate> CreateNewBlock(CChainState& chainstate, const CScript& scriptPubKeyIn);
163162

164163
inline static std::optional<int64_t> m_last_block_num_txs{};
165164
inline static std::optional<int64_t> m_last_block_weight{};

0 commit comments

Comments
 (0)