Skip to content

validation: Review mutable static local variables in CChainState methods #22189

@dongcarl

Description

@dongcarl

Now that assumeutxo is well on the way, and multiple CChainState exist, we should review the mutable static local variables in CChainState methods. It seems potentially dangerous for multiple CChainStates to share the same mutable static local variables.

In CChainState::FlushStateToDisk:

bitcoin/src/validation.cpp

Lines 2154 to 2155 in 82bc7fa

static std::chrono::microseconds nLastWrite{0};
static std::chrono::microseconds nLastFlush{0};

In CChainState::LoadExternalBlockFile (this is fixed by #20331):

static std::multimap<uint256, FlatFilePos> mapBlocksUnknownParent;

ping @jamesob


Now that I think about it... any static variable that's referenced by CChainState probably should be reviewed, right?

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