-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Remove GetDataDir(net_specific)
function
#21850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove GetDataDir(net_specific)
function
#21850
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Code review and concept ACK 2ca79de |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK 2ca79de.
Just my opinion, but I do think since this is switching code to a new ArgsManager interface, it would be better for the interface to have explicit Base and Net methods instead of using the previous bool net_specific=true
default argument. E.g. something like:
public:
const fs::path& GetDataDirBasePath() const { return GetDataDirPath(false); }
const fs::path& GetDataDirNetPath() const { return GetDataDirPath(true); }
private:
const fs::path& GetDataDirPath(bool net_specific) const;
GetDataDirNetPath()
would seem more readable than GetDataDirPath(true)
at call sites, and harder to confuse when writing code. And since call sites are being updated in this PR anyway, implementing this would just require tweaking the scripted diffs.
I find this to be a very good suggestion. If this PR needs to be touched, I would do it in this PR. Otherwise, I would reserve that for a follow-up PR. |
Is there a reason to suffix the return type to the function name? Wouldn't |
Agree. Boolean arguments tend to be bad for readability. |
e75c34e
to
c8616c5
Compare
I have attempted to do the change you propose. Please let me know if you find it better. (I'm sorry about the needless rebase. I got confused by a test result.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK c8616c5
c8616c5
to
17c4128
Compare
a1831d5
to
dfb94ae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
review ACK 849ea30 🍇
Show signature and timestamp
Signature:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
review ACK 849ea30efe96b29ec3023d10b077ffb4f7fa0f86 🍇
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUgybwv/bU7GLhuy9uVt7h3E2faUAPQ2zkOGL9yViqsbXcZyqOUd5XYp8NQFt0Od
ADu7KAStRDEkqMCf0XMI9+Sx1loYVnzXACPvbf8b41+5yAerLOnmig08tDAIoLMc
YMuHK5rHjzrcLiwtrANmsW/jUR7l1pQY7QC5K0wWzSUX3XC69XZ0ZLHnJf2xJv+W
lr+xSFzbDJKcDE0PJQ3veswVGTHIkRw70QdkVj1Us3cX8i7cWADDNCsev9+DolBk
sojoZWDE58Gh/RKB5+dKyi1NpmsMjMJ4KN3l0Cgq6MU1Z8Q1ZiJ1UjwmQNIiGKqC
NNe352Op3nqbhIvXmciUgpTQcYveHmi8OAOv4hYwX2JMCmzM3PdPQ+TDgHuAY8El
PKH6mYTXfdqHow9x9QOpno67/Ei3ubzqmWsFnNTmG825lZEmb5YhviMbUvaEXWSy
6oum6G5mof5Mou4YI72d3cJbrMe0YCgA1P+SzK/jOEx2Hsp6rDw2+LIreBhtzffI
hmJY6Ucg
=7cLP
-----END PGP SIGNATURE-----
Timestamp of file with hash 73e12c06b9e21bd03f9dc8f12311837a91583686ee46b861540ec6de544476d4 -
dfb94ae
to
457515a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approach ACK 457515a.
ACK 457515a 🚊 Show signature and timestampSignature:
Timestamp of file with hash |
…as an intended replacement for `ArgsManager.GetDataDirPath(net_identifier)`
…GetDataDirBase()` in tests -BEGIN VERIFY SCRIPT- git ls-files src/test/*_tests.cpp src/test/util/setup_common.cpp | xargs sed -i 's/.GetDataDirPath()/.GetDataDirBase()/g'; -END VERIFY SCRIPT-
…()` calls -BEGIN VERIFY SCRIPT- git ls-files -- 'src' ':(exclude)src/util/system.h' ':(exclude)src/util/system.cpp' | xargs sed -i 's/GetDataDir()/gArgs.GetDataDirNet()/g'; -END VERIFY SCRIPT-
…rNet()` calls -BEGIN VERIFY SCRIPT- git ls-files -- 'src' ':(exclude)src/util/system.h' ':(exclude)src/util/system.cpp' | xargs sed -i 's/GetDataDir(true)/gArgs.GetDataDirNet()/g'; -END VERIFY SCRIPT-
457515a
to
aca0e5d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK aca0e5d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-ACK aca0e5d 👃
Show signature and timestamp
Signature:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
re-ACK aca0e5dcdb174ef7e88b76910d6fffd633688235 👃
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUiN6Qv/RgP9uS/QKuYzESznN0Tb9TySTikTypK4lmJTJloWTVxqVMWSRaeey4wP
lgnhjfPjicCgooYTHZWb9T1qrQyFrjlRuyBkDANMY0zLvuLikxfTVEc+txoxvIib
cqYHxrf8sfKrv50JJZNpspRNBxgNrgl/0vdDNHisX3+rwm7/oRb6o5WXsWPa3xmv
3UKTnWZ75Z9XTRE5pqQKDtwGsidFay8GVCJPrq0NuB8o50nQBAByfUCD1thOdE5g
nNfunXEPM2hRwgy7/T8AL6fd69STFPoOuiSCWXX+5ASbWNUB8Mwl48o93DxZdIlK
/Sk3jk+q+zTl8nc6aOT3sKR3HK9P5XLUtY5tcmDH6kx9S89/IsCots2gEHL9R0Le
Wxu5hKBcttxMLH6dN/qLa8mK/Q5foDbFEft7Yv0XYYocI9Tc5APA5xkUyYng7Pb7
1FDXJC6Xal/+4aXHNwRLeXIaJgJ6LxQ4mq7xxlIGx5zUH53vIr88rL8B8uRBTn+5
DGxzYjRs
=z/lk
-----END PGP SIGNATURE-----
Timestamp of file with hash f424bad1e3eed91a429f67534ae92bee38c1b1ae4c61eae9451b352c20c8a36b -
Copied GetMainchainAuthCookieFile logic from GetAuthCookieFile, since the former no longer compiled.
This PR is a follow up PR to #21244. The PR attempts to move us an inch towards the goal by removing
GetDataDir(net_specific)
and replacing it bygArgs.GetDataDir(net_specific)
calls.The approach of this PR attempts to be similar to the one chosen in "De-globalize ChainstateManager" (#20158). The goal is to pass
ArgsManager
to functions (or ideally to haveArgsManager
as a member of a class where needed; inspiration from here: #21789) instead of having it as a global variable (i.e.gArgs
).Notes:
m_cached_blocks_path
mutable
as was suggested here but not fully applied in Move GetDataDir to ArgsManager #21244. (m_cached_datadir_path
andm_cached_network_datadir_path
were marked asmutable
in Move GetDataDir to ArgsManager #21244) This commit can be in a separate PR too.GetDataDir(net_specific)
function.gArgs
which is IMO a good thing.If you know about a better approach how to do this, please share it here.