Page MenuHomePhabricator

create net-specific data directory early in init process
ClosedPublic

Authored by markblundeberg on Jun 13 2019, 05:44.

Details

Summary

While backporting #14409 (D3076) I noticed a subtle bug: if
GetBlocksDir(true) is called prior to GetDataDir(true), then GetDataDir
will not create the .bitcoin/regtest/wallets directory, since GetDataDir
expects to be the first one to ever create the net-specific data directory.
This is a weird side-effect behaviour introduced in PR11466 (D2315).

This bug does not manifest on Core, by accident- during InitLogging they
indirectly call GetDataDir(true), and InitLogging happens to get called
before AppInitParameterInteraction (which calls GetBlocksDir).

Test Plan

make check
test_runner.py

Diff Detail

Event Timeline

add TODO comments to aid in clean backporting one day (when Core figures out
how they want to fix this)

Discussions with @Fabien make it clear that this is pretty ugly behaviour, and I've forwarded this problem to Core to see if they have some solutions in mind. https://github.com/bitcoin/bitcoin/issues/16220

This revision is now accepted and ready to land.Jun 15 2019, 18:21