Skip to content

Conversation

@marcoagner
Copy link
Contributor

@marcoagner marcoagner commented May 11, 2018

Fixes #13213.
Mostly, I layed out the concept to open the PR for refinement and getting feedback if the approach is okay. Changes are expected.

Two points:

  • The values for both new consts TESTNET_BLOCK_CHAIN_SIZE and TESTNET_CHAIN_STATE_SIZE is certainly not optimal; I just checked the size of my testnet3 related dirs and set them to little bit higher values. Which values should be used?
  • Should we do something like this to regtest? Or these "niceties" do not matter when on regtest?

Thanks!

@marcoagner marcoagner changed the title [qt] implements concept for different disk sizes on intro [Qt] implements concept for different disk sizes on intro May 11, 2018
@fanquake fanquake added the GUI label May 11, 2018
@ghost
Copy link

ghost commented May 11, 2018

Tested on Ubuntu 16.04: Image
Nano nit: '200GB'/'15GB' should be '200 GB'/'15 GB' for the sake of consistency.

@sipa
Copy link
Member

sipa commented May 11, 2018

Thanks for addressing this issue.

We generally try to avoid having explicit branching on the network type. Instead, I would suggest adding a variable to CChainParams (which is initialized differently in the different network versions).

@marcoagner
Copy link
Contributor Author

marcoagner commented May 11, 2018

Okay, thanks! This will be cleaner.
I will update this PR with the CChainParams approach.

@maflcko
Copy link
Member

maflcko commented May 11, 2018

I will update this PR with the CChainParams approach.

Don't forget to update the release process document as well.

@promag
Copy link
Contributor

promag commented May 12, 2018

Concept ACK.

@practicalswift
Copy link
Contributor

Concept ACK

@jonasschnelli
Copy link
Contributor

utACK,... maybe simplify the code according to #13229

@marcoagner
Copy link
Contributor Author

marcoagner commented May 14, 2018

@jonasschnelli, if #13229 is acceptable, I prefer dropping this PR in favor of #13229. No need to re-do the work here and your approach seems better.

Just as a heads up, it seems that #13229 also explicitly branches the network type (see @sipa's suggestion above). I'm new to the code base and I can't tell for sure if using CChainParams for this Qt issue will be better for the rest of the code as a whole.

What do you think?

@maflcko
Copy link
Member

maflcko commented May 23, 2018

I think it is fine to put it in chainparams, if you call it m_assumed_size (similar to "assumed valid").

@jonasschnelli
Copy link
Contributor

@jonasschnelli, if #13229 is acceptable, I prefer dropping this PR in favor of #13229. No need to re-do the work here and your approach seems better.

Please continue with this and feel free to grab code from 13229...

I had the feeling that this would be GUI only and not appropriate to put Into the chainparams holder... but @sipa and @MarcoFalke think its better there which I guess they are right...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line can be removed now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooops, okay

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds a bit excessive for regtest.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you have any suggestion for this value? thanks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 or 1? :)

It doesn't matter, and it's also unpredictable, as it depends on what blocks are created (regtest is purely for testing purposes, and all blocks are typically explicitly created in the test; there is no real network).

src/qt/intro.cpp Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't include core files directly (this is part of ongoing work to separate the two more cleanly); you'll need to go through the node interface (see the include below).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see! Thank you, I will fix this as soon as I get back.

@marcoagner
Copy link
Contributor Author

marcoagner commented May 29, 2018

Updated do address @sipa's review.
My only comment for now is that the intro message is a bit funny warning that you need at least 0GB... even though that's accurate. :)
The message already didn't totally reflect regtest's reality anyway but let me know if anybody thinks this should be addressed for some reason I can't think of.

@DrahtBot
Copy link
Contributor

DrahtBot commented Sep 28, 2018

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #15114 (Qt: Replace remaining 0 with nullptr by Empact)
  • #15112 (build: Optionally enable -Wzero-as-null-pointer-constant by Empact)

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.

src/qt/intro.cpp Outdated
Copy link
Contributor

@practicalswift practicalswift Oct 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that the comment is already opened with /* on the line above :-)

src/qt/intro.cpp Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that requiredSpace is redefined four lines below :-)

src/qt/intro.cpp Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should catch by reference instead of value. Also missing space before ( :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except this one, other issues were caused by a (obviously bad) merge conflict resolution - bad. I'll take a lot more care so it doesn't happen again.
Thank you for taking the time to review it.

- Creates m_assumed_blockchain_size and m_assumed_chain_state_size on CChainParams.
- Implements access to CChainParams' m_assumed_blockchain_size and m_assumed_chain_state_size on node interface.
- Implements m_assumed_blockchain_size and m_assumed_chain_state_size on qt/intro via node interface.
- Updates release process document with the new CChainParam's values.
@sipa
Copy link
Member

sipa commented Oct 23, 2018

Concept ACK. Code review ACK for non-Qt code 9d0e528

@jonasschnelli
Copy link
Contributor

Re-utACK 9d0e528

@maflcko
Copy link
Member

maflcko commented Oct 23, 2018

utACK 9d0e528 non-qt code.

@marcoagner
Copy link
Contributor Author

Should anything else be done to have this merged?

@jonasschnelli
Copy link
Contributor

Tested ACK 9d0e528

@jonasschnelli jonasschnelli merged commit 9d0e528 into bitcoin:master Jan 12, 2019
jonasschnelli added a commit that referenced this pull request Jan 12, 2019
9d0e528 implements different disk sizes for different networks on intro (marcoagner)

Pull request description:

  Fixes #13213.
  Mostly, I layed out the concept to open the PR for refinement and getting feedback if the approach is okay. Changes are expected.

  Two points:
  - The values for both new consts `TESTNET_BLOCK_CHAIN_SIZE` and `TESTNET_CHAIN_STATE_SIZE` is certainly not optimal; I just checked the size of my testnet3 related dirs and set them to little bit higher values. Which values should be used?
  - Should we do something like this to regtest? Or these "niceties" do not matter when on regtest?

  Thanks!

Tree-SHA512: 8ae87a29fa8356b899e7a823c76cde793d9126b4ee59554d7a2a8edb088fe42a19976b34c06c2fd4a98a727e1e4971dd983f42b6093ea6caa255b45004e22bb4
@marcoagner
Copy link
Contributor Author

Thank you for testing, @jonasschnelli.

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some post-merge observations

try {
node.selectParams(gArgs.GetChainName());
} catch (const std::exception&) {
return false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this will hide all error messages from selectParams

pchMessageStart[3] = 0xd9;
nDefaultPort = 8333;
nPruneAfterHeight = 100000;
m_assumed_blockchain_size = 200;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This used to be 220?

Copy link
Contributor Author

@marcoagner marcoagner Jan 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well spotted, thanks! This was 200 when the PR was first made but changed down the line with this maintenance for 0.17: 78dae8c. Do you think this should be addressed here or could wait for the next maintenance (since the release process now asks for this to be changed)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could bump it to 240 before 0.18 is branched, so we don't forget about it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thanks. Like this? -> #15183


/* If current default data directory does not exist, let the user choose one */
Intro intro;
Intro intro(0, node.getAssumedBlockchainSize(), node.getAssumedChainStateSize());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/0/nullptr/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is another PR for this okay?

maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Feb 14, 2019
…alue

8c3fdd3 fixes m_assumed_blockchain_size variables values: (marcoagner)

Pull request description:

  This is used by Qt but I'm not sure if this is the right tag here.
  Please, edit the title if there's something better.

  `m_assumed_blockchain_size` (src/chainparams.cpp:CChainParams) was
  `BLOCK_CHAIN_SIZE` (src/qt/intro.cpp) and while the transition was being
  made by PR 13216 (merged commit: 9d0e528), 3fc2063 changed its value
  from 200 to 220, which 9d0e528 ended up reverting.

  So, as per MarcoFalke's suggestion (bitcoin#13216 (comment)), I'm bumping it to 240 before 0.18 is
  branched to avoid any confusion.

  Anything else (e.g. constexpr) that should/could be done here? Thanks.

Tree-SHA512: 4319739b870a2b96a57f268f9edc7dd9f9eff5c4ca3b01863e6b861b9ca58c245416ce362dae54d1673e3d5b1c7f5a16e4031842af250e1b1f0a5109b75fb3c3
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Apr 17, 2020
Summary:
- Creates m_assumed_blockchain_size and m_assumed_chain_state_size on CChainParams.
- Implements access to CChainParams' m_assumed_blockchain_size and m_assumed_chain_state_size on node interface.
- Implements m_assumed_blockchain_size and m_assumed_chain_state_size on qt/intro via node interface.
- Updates release process document with the new CChainParam's values.

Backport of core [[ bitcoin/bitcoin#13216 | PR13216 ]].

Test Plan:
  ninja check-all

Build the win64 client and run it on my windows machine.

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D5748
ftrader pushed a commit to bitcoin-cash-node/bitcoin-cash-node that referenced this pull request Aug 17, 2020
Summary:
- Creates m_assumed_blockchain_size and m_assumed_chain_state_size on CChainParams.
- Implements access to CChainParams' m_assumed_blockchain_size and m_assumed_chain_state_size on node interface.
- Implements m_assumed_blockchain_size and m_assumed_chain_state_size on qt/intro via node interface.
- Updates release process document with the new CChainParam's values.

Backport of core [[ bitcoin/bitcoin#13216 | PR13216 ]].

Test Plan:
  ninja check-all

Build the win64 client and run it on my windows machine.

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D5748
UdjinM6 pushed a commit to UdjinM6/dash that referenced this pull request Aug 24, 2021
… on intro

9d0e528 implements different disk sizes for different networks on intro (marcoagner)

Pull request description:

  Fixes bitcoin#13213.
  Mostly, I layed out the concept to open the PR for refinement and getting feedback if the approach is okay. Changes are expected.

  Two points:
  - The values for both new consts `TESTNET_BLOCK_CHAIN_SIZE` and `TESTNET_CHAIN_STATE_SIZE` is certainly not optimal; I just checked the size of my testnet3 related dirs and set them to little bit higher values. Which values should be used?
  - Should we do something like this to regtest? Or these "niceties" do not matter when on regtest?

  Thanks!

Tree-SHA512: 8ae87a29fa8356b899e7a823c76cde793d9126b4ee59554d7a2a8edb088fe42a19976b34c06c2fd4a98a727e1e4971dd983f42b6093ea6caa255b45004e22bb4
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Aug 24, 2021
… on intro

9d0e528 implements different disk sizes for different networks on intro (marcoagner)

Pull request description:

  Fixes bitcoin#13213.
  Mostly, I layed out the concept to open the PR for refinement and getting feedback if the approach is okay. Changes are expected.

  Two points:
  - The values for both new consts `TESTNET_BLOCK_CHAIN_SIZE` and `TESTNET_CHAIN_STATE_SIZE` is certainly not optimal; I just checked the size of my testnet3 related dirs and set them to little bit higher values. Which values should be used?
  - Should we do something like this to regtest? Or these "niceties" do not matter when on regtest?

  Thanks!

Tree-SHA512: 8ae87a29fa8356b899e7a823c76cde793d9126b4ee59554d7a2a8edb088fe42a19976b34c06c2fd4a98a727e1e4971dd983f42b6093ea6caa255b45004e22bb4
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[gui] MainNet and TestNet wallet shows same disk space usage

9 participants