mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-21 14:34:49 +01:00
Revert "miner: Pass in chainstate to BlockAssembler::CreateNewBlock"
This reverts commit d0de61b764
.
This commit is contained in:
parent
eede0647b0
commit
e62067e7bc
2 changed files with 2 additions and 10 deletions
|
@ -97,11 +97,6 @@ void BlockAssembler::resetBlock()
|
|||
}
|
||||
|
||||
std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn)
|
||||
{
|
||||
return CreateNewBlock(::ChainstateActive(), scriptPubKeyIn);
|
||||
}
|
||||
|
||||
std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(CChainState& chainstate, const CScript& scriptPubKeyIn)
|
||||
{
|
||||
int64_t nTimeStart = GetTimeMicros();
|
||||
|
||||
|
@ -119,8 +114,7 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(CChainState& chai
|
|||
pblocktemplate->vTxSigOpsCost.push_back(-1); // updated at end
|
||||
|
||||
LOCK2(cs_main, m_mempool.cs);
|
||||
assert(std::addressof(*::ChainActive().Tip()) == std::addressof(*chainstate.m_chain.Tip()));
|
||||
CBlockIndex* pindexPrev = chainstate.m_chain.Tip();
|
||||
CBlockIndex* pindexPrev = ::ChainActive().Tip();
|
||||
assert(pindexPrev != nullptr);
|
||||
nHeight = pindexPrev->nHeight + 1;
|
||||
|
||||
|
@ -179,8 +173,7 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(CChainState& chai
|
|||
pblocktemplate->vTxSigOpsCost[0] = WITNESS_SCALE_FACTOR * GetLegacySigOpCount(*pblock->vtx[0]);
|
||||
|
||||
BlockValidationState state;
|
||||
assert(std::addressof(::ChainstateActive()) == std::addressof(chainstate));
|
||||
if (!TestBlockValidity(state, chainparams, chainstate, *pblock, pindexPrev, false, false)) {
|
||||
if (!TestBlockValidity(state, chainparams, ::ChainstateActive(), *pblock, pindexPrev, false, false)) {
|
||||
throw std::runtime_error(strprintf("%s: TestBlockValidity failed: %s", __func__, state.ToString()));
|
||||
}
|
||||
int64_t nTime2 = GetTimeMicros();
|
||||
|
|
|
@ -159,7 +159,6 @@ public:
|
|||
|
||||
/** Construct a new block template with coinbase to scriptPubKeyIn */
|
||||
std::unique_ptr<CBlockTemplate> CreateNewBlock(const CScript& scriptPubKeyIn);
|
||||
std::unique_ptr<CBlockTemplate> CreateNewBlock(CChainState& chainstate, const CScript& scriptPubKeyIn);
|
||||
|
||||
inline static std::optional<int64_t> m_last_block_num_txs{};
|
||||
inline static std::optional<int64_t> m_last_block_weight{};
|
||||
|
|
Loading…
Add table
Reference in a new issue