The CHECK_NONFATAL check here may fail when gettxoutsetinfo is called.
0rpc/blockchain.cpp:976 std::optional<kernel::CCoinsStats> GetUTXOStats(CCoinsView *, node::BlockManager &, kernel::CoinStatsHashType, const std::function<void ()> &, const CBlockIndex *, bool): Assertion `!pindex || pindex->GetBlockHash() == view->GetBestBlock()' failed.
I’ve not written a test for this, but looking at the code, it seems that there is a race where the coins view’s best block gets updated in between here and here (e.g. because a new block is connected), causing the check to fail (resulting in an assertion failure in debug builds).
See attached debug logs for an example.
gettxoutsetinfo_check_nonfatal.log
This was found with a test running on Antithesis.