rpc: Use Ensure(Any)Chainman in assumeutxo related RPCs

This commit is contained in:
Fabian Jahr 2023-10-06 19:22:32 +02:00
parent 710e5db61b
commit 5d227a6862
No known key found for this signature in database
GPG key ID: F13D1E9D890798CD

View file

@ -2759,7 +2759,7 @@ static RPCHelpMan loadtxoutset()
LogPrintf("[snapshot] waiting to see blockheader %s in headers chain before snapshot activation\n",
base_blockhash.ToString());
ChainstateManager& chainman = *node.chainman;
ChainstateManager& chainman = EnsureChainman(node);
while (max_secs_to_wait_for_headers > 0) {
snapshot_start_block = WITH_LOCK(::cs_main,
@ -2831,8 +2831,7 @@ return RPCHelpMan{
LOCK(cs_main);
UniValue obj(UniValue::VOBJ);
NodeContext& node = EnsureAnyNodeContext(request.context);
ChainstateManager& chainman = *node.chainman;
ChainstateManager& chainman = EnsureAnyChainman(request.context);
auto make_chain_data = [&](const Chainstate& cs, bool validated) EXCLUSIVE_LOCKS_REQUIRED(::cs_main) {
AssertLockHeld(::cs_main);