Testnet datadir behaviour #2641

issue sipa opened this issue on May 12, 2013
  1. sipa commented at 8:58 AM on May 12, 2013: member

    Reported on the bitcoin-development mailinglist:

    Testnet glitch, something broke...

    Fired up 0.8.2rc, and .... where's the coins? Where's the blocks?

    I get a new empty datadir/testnet3 subdirectory.

    bitcoin-qt.exe -datadir=c:\testnet (with a testnet=1 bitcoin.conf file option in that directory) stored wallet/blocks/chainstate in the root with previous versions. Now the root datadir data is ignored (except the config file) and a new hierarchy was created in subdirectory [b]/testnet3[/b].

    So what's happening?

    This looks to be done by #2605 ... after searching the code for the change and then finding the commit.

    1 day from opened to committed, released six days later... no changelog.

    The datadir previously worked as I expected with both bitcoin-qt and bitcoind interacting with no problems, when simply specifying a command-line datadir, so I don't see the bug.

    I can see how the previous behavior might be dangerous if the config file was removed. I just did that, and there's a cool freakout where my testnet wallet balance looks like real BTC and Bitcoin tries to reorg 67662 blocks starting from the genesis block. After receiving real block 73354 per debug log, a nice unrecoverable crash:

    "Assertion failed!" File: src/main.cpp Line 1745 Expression: pfork != NULL

    This needs to be added to the changelog, since dropping in this binary will break testnet stuff if anybody is using Bitcoin this way for their testnet faucet, etc:

    " * testnet data now stored in testnet3 subdirectory, enforced even when specifying datadir on command line (manually move your data first)"

  2. sipa commented at 9:02 AM on May 12, 2013: member

    @gavinandresen I'm pretty sure that specifying a -datadir explicitly always set the datadir to exactly that, and didn't add testnet3/ afterwards.

    EDIT: I was completely wrong about this.

    Also, this seems to explain #2594 and #2547.

  3. jonasschnelli commented at 10:08 AM on May 12, 2013: contributor

    i'm not sure if its related to pull #2608. Users can specify a -datadir where a bitcoin.conf is placed. The bitcoin.conf can enable testnet (testnet=1). If we not add "testnet3/" to the path of -datadir a mixup between prod- and testnet happens then very quickly.

  4. sipa commented at 10:13 AM on May 12, 2013: member

    @jonasschnelli #2605 reported that bitcoind behaved correctly, and Bitcoin-Qt incorrectly. IMHO, it is the other way around (regarding consistency with before, not arguing what the "right" behaviour should be).

    EDIT: I'm wrong.

  5. jonasschnelli commented at 10:18 AM on May 12, 2013: contributor

    @sipa Right. Someone needs to define the right behavior and then we need to make it consistent.

  6. sipa commented at 10:44 AM on May 12, 2013: member

    It seems I'm seeing ghosts - 0.5, 0.6, 0.7 and 0.8 all add /testnet(3) to the specified datadir in testnet mode.

    So I'm not sure which behaviour changed, that is reported in this issue.

  7. Diapolo commented at 10:52 AM on May 12, 2013: none

    I think the problem is that bitcoin.conf is not net-specific, which it perhaps should be?

    [mainnet] datadir containing bitcoin.conf in root add -testnet [testnet] mainnet datadir containing bitcoin.conf using /testnet3 as testnet datadir

  8. gavinandresen commented at 3:45 PM on May 12, 2013: contributor

    0.8.2rc1 is working as intended.

    I'm guessing the original report was caused by somebody running an earlier git HEAD that had issue #2605 , and they assumed that was the right behavior.

    To summarize:

    The same-as-it-ever-was behavior is: testnet data is always stored in a testnet3/ subdirectory of the datadir. bitcoin.conf is always read from the datadir, though (unless you override with the -conf= option).

  9. gavinandresen closed this on May 12, 2013

  10. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-19 09:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me