@@ -182,18 +182,21 @@ class NodeImpl : public Node
182
182
int getNumBlocks () override
183
183
{
184
184
LOCK (::cs_main);
185
- return ::ChainActive ().Height ();
185
+ assert (std::addressof (::ChainActive ()) == std::addressof (m_context->chainman ->ActiveChain ()));
186
+ return m_context->chainman ->ActiveChain ().Height ();
186
187
}
187
188
uint256 getBestBlockHash () override
188
189
{
189
- const CBlockIndex* tip = WITH_LOCK (::cs_main, return ::ChainActive ().Tip ());
190
+ assert (std::addressof (::ChainActive ()) == std::addressof (m_context->chainman ->ActiveChain ()));
191
+ const CBlockIndex* tip = WITH_LOCK (::cs_main, return m_context->chainman ->ActiveChain ().Tip ());
190
192
return tip ? tip->GetBlockHash () : Params ().GenesisBlock ().GetHash ();
191
193
}
192
194
int64_t getLastBlockTime () override
193
195
{
194
196
LOCK (::cs_main);
195
- if (::ChainActive ().Tip ()) {
196
- return ::ChainActive ().Tip ()->GetBlockTime ();
197
+ assert (std::addressof (::ChainActive ()) == std::addressof (m_context->chainman ->ActiveChain ()));
198
+ if (m_context->chainman ->ActiveChain ().Tip ()) {
199
+ return m_context->chainman ->ActiveChain ().Tip ()->GetBlockTime ();
197
200
}
198
201
return Params ().GenesisBlock ().GetBlockTime (); // Genesis block's time of current network
199
202
}
@@ -202,11 +205,15 @@ class NodeImpl : public Node
202
205
const CBlockIndex* tip;
203
206
{
204
207
LOCK (::cs_main);
205
- tip = ::ChainActive ().Tip ();
208
+ assert (std::addressof (::ChainActive ()) == std::addressof (m_context->chainman ->ActiveChain ()));
209
+ tip = m_context->chainman ->ActiveChain ().Tip ();
206
210
}
207
211
return GuessVerificationProgress (Params ().TxData (), tip);
208
212
}
209
- bool isInitialBlockDownload () override { return ::ChainstateActive ().IsInitialBlockDownload (); }
213
+ bool isInitialBlockDownload () override {
214
+ assert (std::addressof (::ChainstateActive ()) == std::addressof (m_context->chainman ->ActiveChainstate ()));
215
+ return m_context->chainman ->ActiveChainstate ().IsInitialBlockDownload ();
216
+ }
210
217
bool getReindex () override { return ::fReindex ; }
211
218
bool getImporting () override { return ::fImporting ; }
212
219
void setNetworkActive (bool active) override
@@ -231,7 +238,8 @@ class NodeImpl : public Node
231
238
bool getUnspentOutput (const COutPoint& output, Coin& coin) override
232
239
{
233
240
LOCK (::cs_main);
234
- return ::ChainstateActive ().CoinsTip ().GetCoin (output, coin);
241
+ assert (std::addressof (::ChainstateActive ()) == std::addressof (m_context->chainman ->ActiveChainstate ()));
242
+ return m_context->chainman ->ActiveChainstate ().CoinsTip ().GetCoin (output, coin);
235
243
}
236
244
WalletClient& walletClient () override
237
245
{
0 commit comments