2835 | @@ -2836,6 +2836,10 @@ static RPCHelpMan loadtxoutset()
2836 | throw JSONRPCError(RPC_INTERNAL_ERROR, strprintf("Unable to load UTXO snapshot: %s. (%s)", util::ErrorString(activation_result).original, path.utf8string()));
2837 | }
2838 |
2839 | + // Update peer manager best block
2840 | + const auto& tip = WITH_LOCK(chainman.GetMutex(), return chainman.ActiveTip());
2841 | + node.peerman->SetBestBlock(tip->nHeight, std::chrono::seconds{tip->GetBlockTime()});
Are you sure this is the best place for this in the RPC? Looking at the other calls to SetBestBlock() they all seem to be happening in validation.cpp.
nit: You can also get the height out of metadata without the mutex (see below).