bitcoincore improvement – What’s cs_main? Why is it known as cs_main?


What’s cs_main?

cs_main is a recursive mutex which is used to make sure that validation is carried out in an atomic means. It guards entry to validation particular variables (reminiscent of CChainState and CNode) or mempool variables (in net_processing). The lock of cs_main is in validation.cpp.

Why is it known as cs_main?

cs_main was the mutex (“essential part”) that protected information in Satoshi’s authentic principal.cpp. In principle it may very well be renamed as we speak as principal.cpp has since been refactored into smaller recordsdata however each time you rename one thing in a header file, everybody must recompile any file that features that header.

These had been answered by John Newbery and different contributors of the Could twelfth 2021 Bitcoin Core PR overview membership.

Supply hyperlink

Leave a reply