diff options
author | Carl Dong <contact@carldong.me> | 2021-03-16 19:32:22 -0400 |
---|---|---|
committer | Carl Dong <contact@carldong.me> | 2021-03-24 15:40:56 -0400 |
commit | e62067e7bcad5a559899afff2e4a8e8b7e9f4301 (patch) | |
tree | 379f11afc3d9de21963a8d085902cfd3bfa572b1 /src/miner.cpp | |
parent | eede0647b06b6009080c4e536a2705e911d6ee19 (diff) |
Revert "miner: Pass in chainstate to BlockAssembler::CreateNewBlock"
This reverts commit d0de61b764fc7e9c670b69d8210705da296dd245.
Diffstat (limited to 'src/miner.cpp')
-rw-r--r-- | src/miner.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/miner.cpp b/src/miner.cpp index 14443c432d..da2413d06b 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -98,11 +98,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(); resetBlock(); @@ -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(); |