@@ -197,7 +197,6 @@ class NodeImpl : public Node
197
197
int getNumBlocks () override
198
198
{
199
199
LOCK (::cs_main);
200
- assert (std::addressof (::ChainActive ()) == std::addressof (chainman ().ActiveChain ()));
201
200
return chainman ().ActiveChain ().Height ();
202
201
}
203
202
uint256 getBestBlockHash () override
@@ -208,7 +207,6 @@ class NodeImpl : public Node
208
207
int64_t getLastBlockTime () override
209
208
{
210
209
LOCK (::cs_main);
211
- assert (std::addressof (::ChainActive ()) == std::addressof (chainman ().ActiveChain ()));
212
210
if (chainman ().ActiveChain ().Tip ()) {
213
211
return chainman ().ActiveChain ().Tip ()->GetBlockTime ();
214
212
}
@@ -219,7 +217,6 @@ class NodeImpl : public Node
219
217
const CBlockIndex* tip;
220
218
{
221
219
LOCK (::cs_main);
222
- assert (std::addressof (::ChainActive ()) == std::addressof (chainman ().ActiveChain ()));
223
220
tip = chainman ().ActiveChain ().Tip ();
224
221
}
225
222
return GuessVerificationProgress (Params ().TxData (), tip);
@@ -252,7 +249,6 @@ class NodeImpl : public Node
252
249
bool getUnspentOutput (const COutPoint& output, Coin& coin) override
253
250
{
254
251
LOCK (::cs_main);
255
- assert (std::addressof (::ChainstateActive ()) == std::addressof (chainman ().ActiveChainstate ()));
256
252
return chainman ().ActiveChainstate ().CoinsTip ().GetCoin (output, coin);
257
253
}
258
254
WalletClient& walletClient () override
@@ -459,14 +455,12 @@ class ChainImpl : public Chain
459
455
bool checkFinalTx (const CTransaction& tx) override
460
456
{
461
457
LOCK (cs_main);
462
- assert (std::addressof (::ChainActive ()) == std::addressof (chainman ().ActiveChain ()));
463
458
return CheckFinalTx (chainman ().ActiveChain ().Tip (), tx);
464
459
}
465
460
std::optional<int > findLocatorFork (const CBlockLocator& locator) override
466
461
{
467
462
LOCK (cs_main);
468
463
const CChain& active = Assert (m_node.chainman )->ActiveChain ();
469
- assert (std::addressof (g_chainman) == std::addressof (*m_node.chainman ));
470
464
if (CBlockIndex* fork = m_node.chainman ->m_blockman .FindForkInGlobalIndex (active, locator)) {
471
465
return fork->nHeight ;
472
466
}
@@ -476,7 +470,6 @@ class ChainImpl : public Chain
476
470
{
477
471
WAIT_LOCK (cs_main, lock);
478
472
const CChain& active = Assert (m_node.chainman )->ActiveChain ();
479
- assert (std::addressof (g_chainman) == std::addressof (*m_node.chainman ));
480
473
return FillBlock (m_node.chainman ->m_blockman .LookupBlockIndex (hash), block, lock, active);
481
474
}
482
475
bool findFirstBlockWithTimeAndHeight (int64_t min_time, int min_height, const FoundBlock& block) override
@@ -489,7 +482,6 @@ class ChainImpl : public Chain
489
482
{
490
483
WAIT_LOCK (cs_main, lock);
491
484
const CChain& active = Assert (m_node.chainman )->ActiveChain ();
492
- assert (std::addressof (g_chainman) == std::addressof (*m_node.chainman ));
493
485
if (const CBlockIndex* block = m_node.chainman ->m_blockman .LookupBlockIndex (block_hash)) {
494
486
if (const CBlockIndex* ancestor = block->GetAncestor (ancestor_height)) {
495
487
return FillBlock (ancestor, ancestor_out, lock, active);
@@ -501,9 +493,7 @@ class ChainImpl : public Chain
501
493
{
502
494
WAIT_LOCK (cs_main, lock);
503
495
const CChain& active = Assert (m_node.chainman )->ActiveChain ();
504
- assert (std::addressof (g_chainman) == std::addressof (*m_node.chainman ));
505
496
const CBlockIndex* block = m_node.chainman ->m_blockman .LookupBlockIndex (block_hash);
506
- assert (std::addressof (g_chainman) == std::addressof (*m_node.chainman ));
507
497
const CBlockIndex* ancestor = m_node.chainman ->m_blockman .LookupBlockIndex (ancestor_hash);
508
498
if (block && ancestor && block->GetAncestor (ancestor->nHeight ) != ancestor) ancestor = nullptr ;
509
499
return FillBlock (ancestor, ancestor_out, lock, active);
@@ -512,9 +502,7 @@ class ChainImpl : public Chain
512
502
{
513
503
WAIT_LOCK (cs_main, lock);
514
504
const CChain& active = Assert (m_node.chainman )->ActiveChain ();
515
- assert (std::addressof (g_chainman) == std::addressof (*m_node.chainman ));
516
505
const CBlockIndex* block1 = m_node.chainman ->m_blockman .LookupBlockIndex (block_hash1);
517
- assert (std::addressof (g_chainman) == std::addressof (*m_node.chainman ));
518
506
const CBlockIndex* block2 = m_node.chainman ->m_blockman .LookupBlockIndex (block_hash2);
519
507
const CBlockIndex* ancestor = block1 && block2 ? LastCommonAncestor (block1, block2) : nullptr ;
520
508
// Using & instead of && below to avoid short circuiting and leaving
@@ -525,7 +513,6 @@ class ChainImpl : public Chain
525
513
double guessVerificationProgress (const uint256& block_hash) override
526
514
{
527
515
LOCK (cs_main);
528
- assert (std::addressof (g_chainman.m_blockman ) == std::addressof (chainman ().m_blockman ));
529
516
return GuessVerificationProgress (Params ().TxData (), chainman ().m_blockman .LookupBlockIndex (block_hash));
530
517
}
531
518
bool hasBlocks (const uint256& block_hash, int min_height, std::optional<int > max_height) override
@@ -538,7 +525,6 @@ class ChainImpl : public Chain
538
525
// used to limit the range, and passing min_height that's too low or
539
526
// max_height that's too high will not crash or change the result.
540
527
LOCK (::cs_main);
541
- assert (std::addressof (g_chainman.m_blockman ) == std::addressof (chainman ().m_blockman ));
542
528
if (CBlockIndex* block = chainman ().m_blockman .LookupBlockIndex (block_hash)) {
543
529
if (max_height && block->nHeight >= *max_height) block = block->GetAncestor (*max_height);
544
530
for (; block->nStatus & BLOCK_HAVE_DATA; block = block->pprev ) {
0 commit comments