Skip to content

Commit 6c3b5dc

Browse files
committed
scripted-diff: tree-wide: Remove all review-only assertions
-BEGIN VERIFY SCRIPT- find_regex='((assert|CHECK_NONFATAL)\(std::addressof|TODO: REVIEW-ONLY)' \ && git grep -l -E "$find_regex" -- . \ | xargs sed -i -E "/${find_regex}/d" -END VERIFY SCRIPT-
1 parent 3e82abb commit 6c3b5dc

14 files changed

+0
-81
lines changed

src/bench/duplicate_inputs.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ static void DuplicateInputs(benchmark::Bench& bench)
2525
CMutableTransaction naughtyTx{};
2626

2727
LOCK(cs_main);
28-
assert(std::addressof(::ChainActive()) == std::addressof(testing_setup->m_node.chainman->ActiveChain()));
2928
CBlockIndex* pindexPrev = testing_setup->m_node.chainman->ActiveChain().Tip();
3029
assert(pindexPrev != nullptr);
3130
block.nBits = GetNextWorkRequired(pindexPrev, &block, chainparams.GetConsensus());

src/index/base.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ void BaseIndex::Interrupt()
340340

341341
bool BaseIndex::Start(CChainState& active_chainstate)
342342
{
343-
assert(std::addressof(::ChainstateActive()) == std::addressof(active_chainstate));
344343
m_chainstate = &active_chainstate;
345344
// Need to register this ValidationInterface before running Init(), so that
346345
// callbacks are not missed if Init sets m_synced to true.

src/init.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,6 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
13841384

13851385
// If the loaded chain has a wrong genesis, bail out immediately
13861386
// (we're likely using a testnet datadir, or the other way around).
1387-
assert(std::addressof(g_chainman.m_blockman) == std::addressof(chainman.m_blockman));
13881387
if (!chainman.BlockIndex().empty() &&
13891388
!chainman.m_blockman.LookupBlockIndex(chainparams.GetConsensus().hashGenesisBlock)) {
13901389
return InitError(_("Incorrect or no genesis block found. Wrong datadir for network?"));
@@ -1612,7 +1611,6 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
16121611
// Either install a handler to notify us when genesis activates, or set fHaveGenesis directly.
16131612
// No locking, as this happens before any background thread is started.
16141613
boost::signals2::connection block_notify_genesis_wait_connection;
1615-
assert(std::addressof(::ChainActive()) == std::addressof(chainman.ActiveChain()));
16161614
if (chainman.ActiveChain().Tip() == nullptr) {
16171615
block_notify_genesis_wait_connection = uiInterface.NotifyBlockTip_connect(std::bind(BlockNotifyGenesisWait, std::placeholders::_2));
16181616
} else {

src/miner.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& sc
116116
pblocktemplate->vTxSigOpsCost.push_back(-1); // updated at end
117117

118118
LOCK2(cs_main, m_mempool.cs);
119-
assert(std::addressof(*::ChainActive().Tip()) == std::addressof(*m_chainstate.m_chain.Tip()));
120119
CBlockIndex* pindexPrev = m_chainstate.m_chain.Tip();
121120
assert(pindexPrev != nullptr);
122121
nHeight = pindexPrev->nHeight + 1;
@@ -176,7 +175,6 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& sc
176175
pblocktemplate->vTxSigOpsCost[0] = WITNESS_SCALE_FACTOR * GetLegacySigOpCount(*pblock->vtx[0]);
177176

178177
BlockValidationState state;
179-
assert(std::addressof(::ChainstateActive()) == std::addressof(m_chainstate));
180178
if (!TestBlockValidity(state, chainparams, m_chainstate, *pblock, pindexPrev, false, false)) {
181179
throw std::runtime_error(strprintf("%s: TestBlockValidity failed: %s", __func__, state.ToString()));
182180
}

src/net_processing.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,6 @@ PeerManagerImpl::PeerManagerImpl(const CChainParams& chainparams, CConnman& conn
13611361
m_stale_tip_check_time(0),
13621362
m_ignore_incoming_txs(ignore_incoming_txs)
13631363
{
1364-
assert(std::addressof(g_chainman) == std::addressof(m_chainman));
13651364
// Initialize global variables that cannot be constructed at startup.
13661365
recentRejects.reset(new CRollingBloomFilter(120000, 0.000001));
13671366

src/node/blockstorage.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ bool FindBlockPos(FlatFilePos& pos, unsigned int nAddSize, unsigned int nHeight,
248248
// when the undo file is keeping up with the block file, we want to flush it explicitly
249249
// when it is lagging behind (more blocks arrive than are being connected), we let the
250250
// undo block write case handle it
251-
assert(std::addressof(::ChainActive()) == std::addressof(active_chain));
252251
finalize_undo = (vinfoBlockFile[nFile].nHeightLast == (unsigned int)active_chain.Tip()->nHeight);
253252
nFile++;
254253
if (vinfoBlockFile.size() <= nFile) {

src/node/coin.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ void FindCoins(const NodeContext& node, std::map<COutPoint, Coin>& coins)
1313
assert(node.mempool);
1414
assert(node.chainman);
1515
LOCK2(cs_main, node.mempool->cs);
16-
assert(std::addressof(::ChainstateActive()) == std::addressof(node.chainman->ActiveChainstate()));
1716
CCoinsViewCache& chain_view = node.chainman->ActiveChainstate().CoinsTip();
1817
CCoinsViewMemPool mempool_view(&chain_view, *node.mempool);
1918
for (auto& coin : coins) {

src/node/coinstats.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ static bool GetUTXOStats(CCoinsView* view, BlockManager& blockman, CCoinsStats&
9797
if (!pindex) {
9898
{
9999
LOCK(cs_main);
100-
assert(std::addressof(g_chainman.m_blockman) == std::addressof(blockman));
101100
pindex = blockman.LookupBlockIndex(view->GetBestBlock());
102101
}
103102
}

src/node/interfaces.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ class NodeImpl : public Node
197197
int getNumBlocks() override
198198
{
199199
LOCK(::cs_main);
200-
assert(std::addressof(::ChainActive()) == std::addressof(chainman().ActiveChain()));
201200
return chainman().ActiveChain().Height();
202201
}
203202
uint256 getBestBlockHash() override
@@ -208,7 +207,6 @@ class NodeImpl : public Node
208207
int64_t getLastBlockTime() override
209208
{
210209
LOCK(::cs_main);
211-
assert(std::addressof(::ChainActive()) == std::addressof(chainman().ActiveChain()));
212210
if (chainman().ActiveChain().Tip()) {
213211
return chainman().ActiveChain().Tip()->GetBlockTime();
214212
}
@@ -219,7 +217,6 @@ class NodeImpl : public Node
219217
const CBlockIndex* tip;
220218
{
221219
LOCK(::cs_main);
222-
assert(std::addressof(::ChainActive()) == std::addressof(chainman().ActiveChain()));
223220
tip = chainman().ActiveChain().Tip();
224221
}
225222
return GuessVerificationProgress(Params().TxData(), tip);
@@ -252,7 +249,6 @@ class NodeImpl : public Node
252249
bool getUnspentOutput(const COutPoint& output, Coin& coin) override
253250
{
254251
LOCK(::cs_main);
255-
assert(std::addressof(::ChainstateActive()) == std::addressof(chainman().ActiveChainstate()));
256252
return chainman().ActiveChainstate().CoinsTip().GetCoin(output, coin);
257253
}
258254
WalletClient& walletClient() override
@@ -459,14 +455,12 @@ class ChainImpl : public Chain
459455
bool checkFinalTx(const CTransaction& tx) override
460456
{
461457
LOCK(cs_main);
462-
assert(std::addressof(::ChainActive()) == std::addressof(chainman().ActiveChain()));
463458
return CheckFinalTx(chainman().ActiveChain().Tip(), tx);
464459
}
465460
std::optional<int> findLocatorFork(const CBlockLocator& locator) override
466461
{
467462
LOCK(cs_main);
468463
const CChain& active = Assert(m_node.chainman)->ActiveChain();
469-
assert(std::addressof(g_chainman) == std::addressof(*m_node.chainman));
470464
if (CBlockIndex* fork = m_node.chainman->m_blockman.FindForkInGlobalIndex(active, locator)) {
471465
return fork->nHeight;
472466
}
@@ -476,7 +470,6 @@ class ChainImpl : public Chain
476470
{
477471
WAIT_LOCK(cs_main, lock);
478472
const CChain& active = Assert(m_node.chainman)->ActiveChain();
479-
assert(std::addressof(g_chainman) == std::addressof(*m_node.chainman));
480473
return FillBlock(m_node.chainman->m_blockman.LookupBlockIndex(hash), block, lock, active);
481474
}
482475
bool findFirstBlockWithTimeAndHeight(int64_t min_time, int min_height, const FoundBlock& block) override
@@ -489,7 +482,6 @@ class ChainImpl : public Chain
489482
{
490483
WAIT_LOCK(cs_main, lock);
491484
const CChain& active = Assert(m_node.chainman)->ActiveChain();
492-
assert(std::addressof(g_chainman) == std::addressof(*m_node.chainman));
493485
if (const CBlockIndex* block = m_node.chainman->m_blockman.LookupBlockIndex(block_hash)) {
494486
if (const CBlockIndex* ancestor = block->GetAncestor(ancestor_height)) {
495487
return FillBlock(ancestor, ancestor_out, lock, active);
@@ -501,9 +493,7 @@ class ChainImpl : public Chain
501493
{
502494
WAIT_LOCK(cs_main, lock);
503495
const CChain& active = Assert(m_node.chainman)->ActiveChain();
504-
assert(std::addressof(g_chainman) == std::addressof(*m_node.chainman));
505496
const CBlockIndex* block = m_node.chainman->m_blockman.LookupBlockIndex(block_hash);
506-
assert(std::addressof(g_chainman) == std::addressof(*m_node.chainman));
507497
const CBlockIndex* ancestor = m_node.chainman->m_blockman.LookupBlockIndex(ancestor_hash);
508498
if (block && ancestor && block->GetAncestor(ancestor->nHeight) != ancestor) ancestor = nullptr;
509499
return FillBlock(ancestor, ancestor_out, lock, active);
@@ -512,9 +502,7 @@ class ChainImpl : public Chain
512502
{
513503
WAIT_LOCK(cs_main, lock);
514504
const CChain& active = Assert(m_node.chainman)->ActiveChain();
515-
assert(std::addressof(g_chainman) == std::addressof(*m_node.chainman));
516505
const CBlockIndex* block1 = m_node.chainman->m_blockman.LookupBlockIndex(block_hash1);
517-
assert(std::addressof(g_chainman) == std::addressof(*m_node.chainman));
518506
const CBlockIndex* block2 = m_node.chainman->m_blockman.LookupBlockIndex(block_hash2);
519507
const CBlockIndex* ancestor = block1 && block2 ? LastCommonAncestor(block1, block2) : nullptr;
520508
// Using & instead of && below to avoid short circuiting and leaving
@@ -525,7 +513,6 @@ class ChainImpl : public Chain
525513
double guessVerificationProgress(const uint256& block_hash) override
526514
{
527515
LOCK(cs_main);
528-
assert(std::addressof(g_chainman.m_blockman) == std::addressof(chainman().m_blockman));
529516
return GuessVerificationProgress(Params().TxData(), chainman().m_blockman.LookupBlockIndex(block_hash));
530517
}
531518
bool hasBlocks(const uint256& block_hash, int min_height, std::optional<int> max_height) override
@@ -538,7 +525,6 @@ class ChainImpl : public Chain
538525
// used to limit the range, and passing min_height that's too low or
539526
// max_height that's too high will not crash or change the result.
540527
LOCK(::cs_main);
541-
assert(std::addressof(g_chainman.m_blockman) == std::addressof(chainman().m_blockman));
542528
if (CBlockIndex* block = chainman().m_blockman.LookupBlockIndex(block_hash)) {
543529
if (max_height && block->nHeight >= *max_height) block = block->GetAncestor(*max_height);
544530
for (; block->nStatus & BLOCK_HAVE_DATA; block = block->pprev) {

src/node/transaction.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ TransactionError BroadcastTransaction(NodeContext& node, const CTransactionRef t
4040
{ // cs_main scope
4141
assert(node.chainman);
4242
LOCK(cs_main);
43-
assert(std::addressof(::ChainstateActive()) == std::addressof(node.chainman->ActiveChainstate()));
4443
// If the transaction is already confirmed in the chain, don't do anything
4544
// and return early.
4645
CCoinsViewCache &view = node.chainman->ActiveChainstate().CoinsTip();

0 commit comments

Comments
 (0)