Skip to content

rpc: Assertion '!pindex || pindex->GetBlockHash() == view->GetBestBlock()' failed during gettxoutsetinfo #34263

@dergoegge

Description

@dergoegge

The CHECK_NONFATAL check here may fail when gettxoutsetinfo is called.

rpc/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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions