util: Simplify path argument for CBlockTreeDB ctor #17059

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:20191005-blocks-index changing 1 files +1 −1
  1. hebasto commented at 7:15 AM on October 5, 2019: member

    This PR:

    • simplifies path argument (datadir/blocks/index) for CBlockTreeDB constructor
    • does not change behavior as GetBlocksDir() with unset "-blocksdir" returns the same path
    • improves code readability
  2. util: Simplify path argument for CBlockTreeDB ctor
    This commit does not change behavior as GetBlocksDir() with unset 
    "-blocksdir" returns the same path.
    c2bb3919a8
  3. hebasto commented at 7:16 AM on October 5, 2019: member
  4. DrahtBot added the label UTXO Db and Indexes on Oct 5, 2019
  5. MarcoFalke commented at 10:46 AM on October 5, 2019: member

    Needs test/functional/feature_blocksdir.py extended to show the change in behavior

  6. hebasto commented at 10:52 AM on October 5, 2019: member

    Needs test/functional/feature_blocksdir.py extended to show the change in behavior

    What "the change in behavior"? This PR does not introduce any change in behavior.

  7. MarcoFalke commented at 4:53 PM on October 5, 2019: member

    ACK c2bb3919a8cc52ea35d424c1f31f9474f1ea4911

  8. MarcoFalke added the label Refactoring on Oct 5, 2019
  9. in src/txdb.cpp:148 in c2bb3919a8
     144 | @@ -145,7 +145,7 @@ size_t CCoinsViewDB::EstimateSize() const
     145 |      return db.EstimateSize(DB_COIN, (char)(DB_COIN+1));
     146 |  }
     147 |  
     148 | -CBlockTreeDB::CBlockTreeDB(size_t nCacheSize, bool fMemory, bool fWipe) : CDBWrapper(gArgs.IsArgSet("-blocksdir") ? GetDataDir() / "blocks" / "index" : GetBlocksDir() / "index", nCacheSize, fMemory, fWipe) {
     149 | +CBlockTreeDB::CBlockTreeDB(size_t nCacheSize, bool fMemory, bool fWipe) : CDBWrapper(GetDataDir() / "blocks" / "index", nCacheSize, fMemory, fWipe) {
    


    laanwj commented at 11:23 AM on October 6, 2019:

    Didn't you pick the wrong side here? Shouldn't this be GetBlocksDir() / "index" instead? Otherwise it seems it's losing the functionality of -blocksdir.


    hebasto commented at 12:00 PM on October 6, 2019:

    Didn't you pick the wrong side here?

    This PR does not introduce any change in behavior.

    Shouldn't this be GetBlocksDir() / "index" instead? Otherwise it seems it's losing the functionality of -blocksdir.

    -blocksdir allows to place raw blocks to a large and slow HDD, while it leaves blockindex on a fast SSD.

    Ref: #12653


    laanwj commented at 9:46 AM on October 8, 2019:

    Whoops. Your'ee right. Thanks for the simplification, that's quite sneaky. I was reading it the wrong way around.

    In the future let's review more carefully for people to use an explicit if() statement instead of cramming this kind of logic into an initializer.

  10. promag commented at 1:51 PM on October 6, 2019: member

    ACK c2bb3919a8cc52ea35d424c1f31f9474f1ea4911.

  11. laanwj commented at 9:47 AM on October 8, 2019: member

    ACK c2bb3919a8cc52ea35d424c1f31f9474f1ea4911

  12. laanwj referenced this in commit 9f8cd0ac89 on Oct 8, 2019
  13. laanwj merged this on Oct 8, 2019
  14. laanwj closed this on Oct 8, 2019

  15. hebasto deleted the branch on Oct 8, 2019
  16. sidhujag referenced this in commit 878c8e523c on Oct 8, 2019
  17. jasonbcox referenced this in commit 6fdaf6f55d on Oct 26, 2020
  18. random-zebra referenced this in commit edfaec63c2 on May 1, 2021
  19. PastaPastaPasta referenced this in commit 84835eecf7 on Nov 1, 2021
  20. PastaPastaPasta referenced this in commit 29f354e8ec on Nov 3, 2021
  21. pravblockc referenced this in commit f05deea3c9 on Nov 18, 2021
  22. 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: 2026-04-18 09:14 UTC

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