@@ -202,15 +202,7 @@ class NodeImpl : public Node
202
202
}
203
203
uint256 getBestBlockHash () override
204
204
{
205
- const CBlockIndex* tip;
206
- {
207
- // TODO: Temporary scope to check correctness of refactored code.
208
- // Should be removed manually after merge of
209
- // https://github.com/bitcoin/bitcoin/pull/20158
210
- LOCK (cs_main);
211
- assert (std::addressof (::ChainActive ()) == std::addressof (chainman ().ActiveChain ()));
212
- tip = chainman ().ActiveChain ().Tip ();
213
- }
205
+ const CBlockIndex* tip = WITH_LOCK (::cs_main, return chainman ().ActiveChain ().Tip ());
214
206
return tip ? tip->GetBlockHash () : Params ().GenesisBlock ().GetHash ();
215
207
}
216
208
int64_t getLastBlockTime () override
@@ -233,16 +225,7 @@ class NodeImpl : public Node
233
225
return GuessVerificationProgress (Params ().TxData (), tip);
234
226
}
235
227
bool isInitialBlockDownload () override {
236
- const CChainState* active_chainstate;
237
- {
238
- // TODO: Temporary scope to check correctness of refactored code.
239
- // Should be removed manually after merge of
240
- // https://github.com/bitcoin/bitcoin/pull/20158
241
- LOCK (::cs_main);
242
- active_chainstate = &m_context->chainman ->ActiveChainstate ();
243
- assert (std::addressof (::ChainstateActive ()) == std::addressof (*active_chainstate));
244
- }
245
- return active_chainstate->IsInitialBlockDownload ();
228
+ return chainman ().ActiveChainstate ().IsInitialBlockDownload ();
246
229
}
247
230
bool getReindex () override { return ::fReindex ; }
248
231
bool getImporting () override { return ::fImporting ; }
@@ -647,16 +630,7 @@ class ChainImpl : public Chain
647
630
}
648
631
bool isReadyToBroadcast () override { return !::fImporting && !::fReindex && !isInitialBlockDownload (); }
649
632
bool isInitialBlockDownload () override {
650
- const CChainState* active_chainstate;
651
- {
652
- // TODO: Temporary scope to check correctness of refactored code.
653
- // Should be removed manually after merge of
654
- // https://github.com/bitcoin/bitcoin/pull/20158
655
- LOCK (::cs_main);
656
- active_chainstate = &chainman ().ActiveChainstate ();
657
- assert (std::addressof (::ChainstateActive ()) == std::addressof (*active_chainstate));
658
- }
659
- return active_chainstate->IsInitialBlockDownload ();
633
+ return chainman ().ActiveChainstate ().IsInitialBlockDownload ();
660
634
}
661
635
bool shutdownRequested () override { return ShutdownRequested (); }
662
636
int64_t getAdjustedTime () override { return GetAdjustedTime (); }
0 commit comments