utils and libraries: Make ‘blocksdir’ always net specific #14409

pull hebasto wants to merge 2 commits into bitcoin:master from hebasto:20181005-blockspath-always-netspecific changing 4 files +8 −8
  1. hebasto commented at 6:25 pm on October 5, 2018: member

    The blocks directory is net specific by definition.

    Also this prevents the side effect of calling GetBlocksDir(false) in the non-mainnet environment. Currently a new node creates an unused blocks\ directory in the root of the data directory when -testnet or -regtest is specified.

    Refs:

  2. hebasto renamed this:
    utils and libraries: Make blockdir always net specific
    utils and libraries: Make 'blocksdir' always net specific
    on Oct 5, 2018
  3. DrahtBot commented at 7:06 pm on October 5, 2018: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #13746 (-masterdatadir for datadir bootstrapping by kallewoof)

    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.

  4. fanquake added the label Utils/log/libs on Oct 5, 2018
  5. ken2812221 commented at 4:11 pm on October 6, 2018: contributor
    Concept ACK. This seem to require a release note.
  6. MarcoFalke added the label Needs release notes on Oct 7, 2018
  7. MarcoFalke commented at 4:58 am on October 9, 2018: member
    Needs tests before merge
  8. meshcollider commented at 2:40 pm on October 12, 2018: contributor
    Concept ACK, so this only affects the case where the user has explicitly specified a directory with the -blocksdir argument right?
  9. hebasto commented at 2:49 pm on October 12, 2018: member

    @MeshCollider

    Thank you for your review.

    Concept ACK, so this only affects the case where the user has explicitly specified a directory with the -blocksdir argument right?

    This PR works regardless of the -blocksdir option.

  10. sipa commented at 7:09 pm on October 12, 2018: member
    Does this risk breaking any existing configurations?
  11. meshcollider commented at 11:06 pm on October 12, 2018: contributor
    @sipa that was my concern, the actual behaviour looks unchanged but I think now if you specify a base directory with -blocksdir it will error if the child directory doesn’t exist, previously it would just create it? Which could be annoying for users…
  12. hebasto commented at 10:42 am on October 13, 2018: member

    @MeshCollider @sipa

    … I think now if you specify a base directory with -blocksdir it will error if the child directory doesn’t exist, previously it would just create it?

    Test of this PR:

     0$ rm -rf /home/hebasto/.bitcoin/
     1$ /home/hebasto/github/bitcoin/src/bitcoind
     22018-10-13T09:27:14Z Bitcoin Core version v0.17.99.0-c1a60d4a1 (release build)
     3...
     42018-10-13T09:27:30Z Shutdown: done
     5$ find /home/hebasto/.bitcoin/ > ~/pr14409-without-blocksdir
     6
     7$ rm -rf /home/hebasto/.bitcoin/
     8$ /home/hebasto/github/bitcoin/src/bitcoind -blocksdir=/home/hebasto/.bitcoin/TEST_DIR/TEST_BLOCKS_DIR
     92018-10-13T09:33:59Z Bitcoin Core version v0.17.99.0-c1a60d4a1 (release build)
    102018-10-13T09:33:59Z InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
    112018-10-13T09:33:59Z Error: Specified blocks directory "/home/hebasto/.bitcoin/TEST_DIR/TEST_BLOCKS_DIR" does not exist.
    12Error: Specified blocks directory "/home/hebasto/.bitcoin/TEST_DIR/TEST_BLOCKS_DIR" does not exist
    13$ mkdir -p /home/hebasto/.bitcoin/TEST_DIR/TEST_BLOCKS_DIR
    14$ /home/hebasto/github/bitcoin/src/bitcoind -blocksdir=/home/hebasto/.bitcoin/TEST_DIR/TEST_BLOCKS_DIR
    152018-10-13T09:36:37Z Bitcoin Core version v0.17.99.0-c1a60d4a1 (release build)
    16...
    172018-10-13T09:37:00Z Shutdown: done
    18$ find /home/hebasto/.bitcoin/ > ~/pr14409-with-blocksdir
    19
    20$ diff ~/pr14409-without-blocksdir ~/pr14409-with-blocksdir 
    213a4,8
    22> /home/hebasto/.bitcoin/TEST_DIR
    23> /home/hebasto/.bitcoin/TEST_DIR/TEST_BLOCKS_DIR
    24> /home/hebasto/.bitcoin/TEST_DIR/TEST_BLOCKS_DIR/blocks
    25> /home/hebasto/.bitcoin/TEST_DIR/TEST_BLOCKS_DIR/blocks/rev00000.dat
    26> /home/hebasto/.bitcoin/TEST_DIR/TEST_BLOCKS_DIR/blocks/blk00000.dat
    2712d16
    28< /home/hebasto/.bitcoin/blocks/rev00000.dat
    2918d21
    30< /home/hebasto/.bitcoin/blocks/blk00000.dat
    

    Test of master be992701b:

     0$ rm -rf /home/hebasto/.bitcoin/
     1$ /home/hebasto/github/bitcoin/src/bitcoind
     22018-10-13T10:19:33Z Bitcoin Core version v0.17.99.0-be992701b (release build)
     3...
     42018-10-13T10:19:51Z Shutdown: done
     5$ find /home/hebasto/.bitcoin/ > ~/master-be992701b-without-blocksdir
     6
     7$ rm -rf /home/hebasto/.bitcoin/
     8$ /home/hebasto/github/bitcoin/src/bitcoind -blocksdir=/home/hebasto/.bitcoin/TEST_DIR/TEST_BLOCKS_DIR
     92018-10-13T10:22:30Z Bitcoin Core version v0.17.99.0-be992701b (release build)
    102018-10-13T10:22:30Z InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
    112018-10-13T10:22:30Z Error: Specified blocks directory "/home/hebasto/.bitcoin/TEST_DIR/TEST_BLOCKS_DIR" does not exist.
    12Error: Specified blocks directory "/home/hebasto/.bitcoin/TEST_DIR/TEST_BLOCKS_DIR" does not exist.
    13$ mkdir -p /home/hebasto/.bitcoin/TEST_DIR/TEST_BLOCKS_DIR
    14$ /home/hebasto/github/bitcoin/src/bitcoind -blocksdir=/home/hebasto/.bitcoin/TEST_DIR/TEST_BLOCKS_DIR
    152018-10-13T10:23:18Z Bitcoin Core version v0.17.99.0-be992701b (release build)
    16...
    172018-10-13T10:23:35Z Shutdown: done
    18$ find /home/hebasto/.bitcoin/ > ~/master-be992701b-with-blocksdir
    19
    20$ diff ~/master-be992701b-without-blocksdir ~/master-be992701b-with-blocksdir 
    213a4,8
    22> /home/hebasto/.bitcoin/TEST_DIR
    23> /home/hebasto/.bitcoin/TEST_DIR/TEST_BLOCKS_DIR
    24> /home/hebasto/.bitcoin/TEST_DIR/TEST_BLOCKS_DIR/blocks
    25> /home/hebasto/.bitcoin/TEST_DIR/TEST_BLOCKS_DIR/blocks/rev00000.dat
    26> /home/hebasto/.bitcoin/TEST_DIR/TEST_BLOCKS_DIR/blocks/blk00000.dat
    2712d16
    28< /home/hebasto/.bitcoin/blocks/rev00000.dat
    2918d21
    30< /home/hebasto/.bitcoin/blocks/blk00000.dat
    

    The behaviour is unchanged. If you specify a base directory with -blocksdir and if the child directory doesn’t exist it will an error both on master and on this PR.

  13. MarcoFalke added the label Refactoring on Oct 23, 2018
  14. MarcoFalke removed the label Needs release notes on Oct 23, 2018
  15. MarcoFalke removed the label Refactoring on Oct 23, 2018
  16. DrahtBot added the label Needs rebase on Nov 5, 2018
  17. Make blockdir always net specific
    The blocks directory is net specific by definition.
    
    Also this prevents the side effect of calling GetBlocksDir(false) in the
    non-mainnet environment.
    c3f1821ac7
  18. hebasto force-pushed on Nov 5, 2018
  19. hebasto commented at 11:29 am on November 5, 2018: member
    Rebased.
  20. DrahtBot removed the label Needs rebase on Nov 5, 2018
  21. laanwj commented at 7:06 am on November 23, 2018: member

    This absolutely needs testing in a functional test.

    Also to make it clear what behavior is failing right now, and which will pass after this.

  22. Improve blocksdir functional test.
    A new node should not create an unused `blocks` directory in the root of
    the data directory when `-testnet` or `-regtest` is specified.
    e4a0c3547e
  23. hebasto commented at 3:23 pm on November 30, 2018: member

    @laanwj Thank you for your review.

    This absolutely needs testing in a functional test. Also to make it clear what behavior is failing right now, and which will pass after this.

    The existed feature_blocksdir.py functional test has been patched. Currently this patched test fails on master.

  24. laanwj commented at 2:57 pm on December 13, 2018: member
    utACK e4a0c3547ed886871f8b3d51c6b4ffdb181a8b9c
  25. MarcoFalke commented at 5:52 pm on December 22, 2018: member
    utACK e4a0c3547ed886871f8b3d51c6b4ffdb181a8b9c
  26. laanwj merged this on Jan 16, 2019
  27. laanwj closed this on Jan 16, 2019

  28. laanwj referenced this in commit 64ee94356f on Jan 16, 2019
  29. hebasto deleted the branch on Jan 16, 2019
  30. MarcoFalke added the label Needs backport on Feb 9, 2019
  31. MarcoFalke added this to the milestone 0.17.2 on Feb 9, 2019
  32. hebasto referenced this in commit 75bee85900 on Feb 22, 2019
  33. hebasto referenced this in commit 8cdd72e7e8 on Feb 22, 2019
  34. fanquake removed the label Needs backport on Mar 11, 2019
  35. fanquake commented at 0:52 am on March 11, 2019: member
    Being backported in #15445.
  36. random-zebra referenced this in commit edfaec63c2 on May 1, 2021
  37. PastaPastaPasta referenced this in commit c1d86731ef on Jun 26, 2021
  38. PastaPastaPasta referenced this in commit a8c5821419 on Jun 27, 2021
  39. PastaPastaPasta referenced this in commit b12c459007 on Jun 28, 2021
  40. DrahtBot locked this on Dec 16, 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: 2024-12-22 18:12 UTC

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