Skip to content

06082026/cnodestate#3

Open
Crypt-iQ wants to merge 2 commits into
masterfrom
06082026/cnodestate
Open

06082026/cnodestate#3
Crypt-iQ wants to merge 2 commits into
masterfrom
06082026/cnodestate

Conversation

@Crypt-iQ

Copy link
Copy Markdown
Owner

No description provided.

Both m_requested_hb_cmpctblocks & m_provides_cmpctblocks were
protected by cs_main which is unnecessary. Instead convert them
to std::atomic<bool> as Mutex is not needed. This way we don't
need to worry about potential lock inversion in the future or
thread safety annotations.
@Crypt-iQ Crypt-iQ force-pushed the 06082026/cnodestate branch from 0e58ffb to 42031e8 Compare June 17, 2026 16:13
Also make the m_num_preferred_download_peers counter atomic and add
an assert in FinalizeNode. The asserts for m_num_preferred_download_peers
in FinalizeNode are still safe even without cs_main locking because of
the implicit guarantee that ProcessMessage may not run for a peer
at the same time as FinalizeNode. This has the nice benefit of being
able to remove cs_main usage in some places.
@Crypt-iQ Crypt-iQ force-pushed the 06082026/cnodestate branch from 42031e8 to 765f659 Compare June 18, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant