cryptonote_core: restore separate fakechain data dir for core_tests
What changed, and why it matters
This commit fixes a test-only data-directory path so that certain internal test modes once again store their temporary blockchain data in a separate 'fake' folder rather than potentially mixing with the main config folder. It does not change live mainnet/regtest node behavior and appears to be a regression fix for unit-test isolation.
No immediate action required for production node operators. Developers running core_tests should verify that test data is again isolated under the 'fake' subdirectory. Consider adding a regression test to ensure FAKECHAIN + !regtest callers always use the isolated directory.
Security signals we found
Data-directory isolation regression fix
Test-only code path change
Potential directory collision between fakechain tests and production config data
Evidence from the diff
The change restores legacy fakechain isolation for core_tests. When the network type is FAKECHAIN but the –regtest command-line flag is not set (because tests set FAKECHAIN via test_options directly), the code now appends ‘fake’ to m_config_folder. –regtest already appended ‘fake’ through arg_data_dir, so this only affects callers that bypass the command-line path. The patch prevents core_tests from writing blockchain data into the same directory as normal configuration data.
Changed components
src/cryptonote_core/cryptonote_core.cppcore_testsFAKECHAIN test network initializationInspect captured patch +5 / −0
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp
index a22edca..5f772c3 100644
--- a/src/cryptonote_core/cryptonote_core.cpp
+++ b/src/cryptonote_core/cryptonote_core.cpp
@@ -489,6 +489,11 @@ namespace cryptonote
bool keep_fakechain = command_line::get_arg(vm, arg_keep_fakechain);
boost::filesystem::path folder(m_config_folder);
+ // --regtest already appends "fake" through arg_data_dir. Some tests set
+ // FAKECHAIN directly through test_options instead of command line args, so
+ // preserve the legacy fakechain isolation for those callers.
+ if (m_nettype == FAKECHAIN && !command_line::get_arg(vm, arg_regtest_on))
+ folder /= "fake";
// make sure the data directory exists, and try to lock it
CHECK_AND_ASSERT_MES (boost::filesystem::exists(folder) || boost::filesystem::create_directories(folder), false,
Why this scored 16/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.