p2p: isolate regtest from mainnet bootstrap state#10396
p2p: isolate regtest from mainnet bootstrap state#10396jeetrex17 wants to merge 3 commits intomonero-project:masterfrom
Conversation
src/p2p/net_node.inl
Outdated
| if (m_nettype == cryptonote::FAKECHAIN) | ||
| m_config_folder += "/fake"; |
There was a problem hiding this comment.
This doesnt work as expected.
example:
when using --testnet the default blockchain folder will be ~/.bitmonero/testnet/lmdb
when using --regrest the default blockchain folder will be ~/.bitmonero/fake/lmdb
when NOT using the default folder (ie, when using somethinf like --data-dir testing the latter will fail with an error of:
2026-04-02 21:48:38.803 E Exception in main! boost::filesystem::create_directory: Not a directory: "testing/fake"
This error does not happen with --testnet. Using data-dir with testnet will create a folder like ./testing/testnet
Can you make it create the subfolder in the same way that testnet and stagenet subfolders are created?
(Also, i would prefer if the subfolder be called regtest instead of fake)
There was a problem hiding this comment.
Thanks for pointing that out. Addressed in 3348a4b.
Regtest data-dir handling is now normalized through arg_data_dir the same way as testnet/stagenet, so both core and p2p use <data-dir>/regtest instead of appending a subfolder later. I also switched the regtest subfolder from fake to regtest.
There was a problem hiding this comment.
Also, i would prefer if the subfolder be called
regtestinstead offake
Considering the subfolder for the blockchain dir is already located in fake when using --regtest, I'd advocate for continuing to use fake to avoid breaking any flows that may rely on current behavior. There is even explicit logic for removing or reusing the already stored data in that dir
There was a problem hiding this comment.
the subfolder for the blockchain dir is already located in fake when using --regtest
you're right. I neglected to pay attention to what the current behavior was
There was a problem hiding this comment.
Makes sense, thanks. Switched it back to fake in 7a14dea while keeping the centralized data-dir handling.
|
Ran a few different tests (generating blocks, peering, syncing wallet, sending txs etc). this pr appears to resolve the linked issue, and is working as expected / havent found any other regressions (after data-dir was fixed) |
Fixes #10392.
--regtestwasn't being handled in the p2p layer, so it defaulted to mainnet. That meant regtest could resolveseeds.moneroseeds.*, fall back to the hardcoded mainnet seed list, and sharep2pstate.binwith mainnet.This patch makes p2p treat
--regtestasFAKECHAIN, skips automatic public seed bootstrap for that mode, and stores p2p state under<data-dir>/faketo keep it separate from mainnet.