mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
Merge #13216: [Qt] implements concept for different disk sizes on intro
9d0e52834 implements different disk sizes for different networks on intro (marcoagner) Pull request description: Fixes https://github.com/bitcoin/bitcoin/issues/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
This commit is contained in:
parent
b39ec37988
commit
583c2ee123
@ -21,7 +21,7 @@ Before every minor and major release:
|
||||
Before every major release:
|
||||
|
||||
* Update hardcoded [seeds](/contrib/seeds/README.md). TODO: Give example PR for Dash
|
||||
* Update [`BLOCK_CHAIN_SIZE`](/src/qt/intro.cpp) to the current size plus some overhead.
|
||||
* Update [`src/chainparams.cpp`](/src/chainparams.cpp) m_assumed_blockchain_size and m_assumed_chain_state_size with the current size plus some overhead.
|
||||
* Update `src/chainparams.cpp` chainTxData with statistics about the transaction count and rate. Use the output of the RPC `getchaintxstats`, see
|
||||
[this pull request](https://github.com/bitcoin/bitcoin/pull/12270) for an example. Reviewers can verify the results by running `getchaintxstats <window_block_count> <window_last_block_hash>` with the `window_block_count` and `window_last_block_hash` from your output.
|
||||
* Update version of `contrib/gitian-descriptors/*.yml`: usually one'd want to do this on master after branching off the release - but be sure to at least do it before a new major release
|
||||
|
@ -423,6 +423,8 @@ public:
|
||||
pchMessageStart[3] = 0xbd;
|
||||
nDefaultPort = 9999;
|
||||
nPruneAfterHeight = 100000;
|
||||
m_assumed_blockchain_size = 35;
|
||||
m_assumed_chain_state_size = 1;
|
||||
|
||||
genesis = CreateGenesisBlock(1390095618, 28917698, 0x1e0ffff0, 1, 50 * COIN);
|
||||
consensus.hashGenesisBlock = genesis.GetHash();
|
||||
@ -626,6 +628,8 @@ public:
|
||||
pchMessageStart[3] = 0xff;
|
||||
nDefaultPort = 19999;
|
||||
nPruneAfterHeight = 1000;
|
||||
m_assumed_blockchain_size = 3;
|
||||
m_assumed_chain_state_size = 1;
|
||||
|
||||
genesis = CreateGenesisBlock(1390666206UL, 3861367235UL, 0x1e0ffff0, 1, 50 * COIN);
|
||||
consensus.hashGenesisBlock = genesis.GetHash();
|
||||
@ -806,6 +810,8 @@ public:
|
||||
pchMessageStart[3] = 0xce;
|
||||
nDefaultPort = 19799;
|
||||
nPruneAfterHeight = 1000;
|
||||
m_assumed_blockchain_size = 0;
|
||||
m_assumed_chain_state_size = 0;
|
||||
|
||||
genesis = CreateGenesisBlock(1417713337, 1096447, 0x207fffff, 1, 50 * COIN);
|
||||
consensus.hashGenesisBlock = genesis.GetHash();
|
||||
@ -962,6 +968,8 @@ public:
|
||||
pchMessageStart[3] = 0xdc;
|
||||
nDefaultPort = 19899;
|
||||
nPruneAfterHeight = 1000;
|
||||
m_assumed_blockchain_size = 0;
|
||||
m_assumed_chain_state_size = 0;
|
||||
|
||||
genesis = CreateGenesisBlock(1417713337, 1096447, 0x207fffff, 1, 50 * COIN);
|
||||
consensus.hashGenesisBlock = genesis.GetHash();
|
||||
|
@ -70,6 +70,10 @@ public:
|
||||
/** Require addresses specified with "-externalip" parameter to be routable */
|
||||
bool RequireRoutableExternalIP() const { return fRequireRoutableExternalIP; }
|
||||
uint64_t PruneAfterHeight() const { return nPruneAfterHeight; }
|
||||
/** Minimum free space (in GB) needed for data directory */
|
||||
uint64_t AssumedBlockchainSize() const { return m_assumed_blockchain_size; }
|
||||
/** Minimum free space (in GB) needed for data directory when pruned; Does not include prune target*/
|
||||
uint64_t AssumedChainStateSize() const { return m_assumed_chain_state_size; }
|
||||
/** Make miner stop after a block is found. In RPC, don't return until nGenProcLimit blocks are generated */
|
||||
bool MineBlocksOnDemand() const { return fMineBlocksOnDemand; }
|
||||
/** Allow multiple addresses to be selected from the same network group (e.g. 192.168.x.x) */
|
||||
@ -109,6 +113,8 @@ protected:
|
||||
CMessageHeader::MessageStartChars pchMessageStart;
|
||||
int nDefaultPort;
|
||||
uint64_t nPruneAfterHeight;
|
||||
uint64_t m_assumed_blockchain_size;
|
||||
uint64_t m_assumed_chain_state_size;
|
||||
std::vector<std::string> vSeeds;
|
||||
std::vector<unsigned char> base58Prefixes[MAX_BASE58_TYPES];
|
||||
int nExtCoinType;
|
||||
|
@ -169,6 +169,8 @@ class NodeImpl : public Node
|
||||
bool softSetArg(const std::string& arg, const std::string& value) override { return gArgs.SoftSetArg(arg, value); }
|
||||
bool softSetBoolArg(const std::string& arg, bool value) override { return gArgs.SoftSetBoolArg(arg, value); }
|
||||
void selectParams(const std::string& network) override { SelectParams(network); }
|
||||
uint64_t getAssumedBlockchainSize() override { return Params().AssumedBlockchainSize(); }
|
||||
uint64_t getAssumedChainStateSize() override { return Params().AssumedChainStateSize(); }
|
||||
std::string getNetwork() override { return Params().NetworkIDString(); }
|
||||
void initLogging() override { InitLogging(); }
|
||||
void initParameterInteraction() override { InitParameterInteraction(); }
|
||||
|
@ -108,6 +108,12 @@ public:
|
||||
//! Choose network parameters.
|
||||
virtual void selectParams(const std::string& network) = 0;
|
||||
|
||||
//! Get the (assumed) blockchain size.
|
||||
virtual uint64_t getAssumedBlockchainSize() = 0;
|
||||
|
||||
//! Get the (assumed) chain state size.
|
||||
virtual uint64_t getAssumedChainStateSize() = 0;
|
||||
|
||||
//! Get network name.
|
||||
virtual std::string getNetwork() = 0;
|
||||
|
||||
|
@ -23,10 +23,6 @@
|
||||
#include <cmath>
|
||||
|
||||
static const uint64_t GB_BYTES = 1000000000LL;
|
||||
/* Minimum free space (in GB) needed for data directory */
|
||||
static const uint64_t BLOCK_CHAIN_SIZE = 35;
|
||||
/* Minimum free space (in GB) needed for data directory when pruned; Does not include prune target */
|
||||
static const uint64_t CHAIN_STATE_SIZE = 1;
|
||||
/* Total required space (in GB) depending on user choice (prune, not prune) */
|
||||
static uint64_t requiredSpace;
|
||||
|
||||
@ -115,11 +111,13 @@ void FreespaceChecker::check()
|
||||
}
|
||||
|
||||
|
||||
Intro::Intro(QWidget *parent) :
|
||||
Intro::Intro(QWidget *parent, uint64_t blockchain_size, uint64_t chain_state_size) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::Intro),
|
||||
thread(0),
|
||||
signalled(false)
|
||||
signalled(false),
|
||||
m_blockchain_size(blockchain_size),
|
||||
m_chain_state_size(chain_state_size)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->welcomeLabel->setText(ui->welcomeLabel->text().arg(tr(PACKAGE_NAME)));
|
||||
@ -127,14 +125,14 @@ Intro::Intro(QWidget *parent) :
|
||||
|
||||
ui->lblExplanation1->setText(ui->lblExplanation1->text()
|
||||
.arg(tr(PACKAGE_NAME))
|
||||
.arg(BLOCK_CHAIN_SIZE)
|
||||
.arg(m_blockchain_size)
|
||||
.arg(2014)
|
||||
.arg("Dash")
|
||||
);
|
||||
ui->lblExplanation2->setText(ui->lblExplanation2->text().arg(tr(PACKAGE_NAME)));
|
||||
|
||||
uint64_t pruneTarget = std::max<int64_t>(0, gArgs.GetArg("-prune", 0));
|
||||
requiredSpace = BLOCK_CHAIN_SIZE;
|
||||
requiredSpace = m_blockchain_size;
|
||||
QString storageRequiresMsg = tr("At least %1 GB of data will be stored in this directory, and it will grow over time.");
|
||||
if (pruneTarget) {
|
||||
uint64_t prunedGBs = std::ceil(pruneTarget * 1024 * 1024.0 / GB_BYTES);
|
||||
@ -146,7 +144,7 @@ Intro::Intro(QWidget *parent) :
|
||||
} else {
|
||||
ui->lblExplanation3->setVisible(false);
|
||||
}
|
||||
requiredSpace += CHAIN_STATE_SIZE;
|
||||
requiredSpace += m_chain_state_size;
|
||||
ui->sizeWarningLabel->setText(
|
||||
tr("%1 will download and store a copy of the Dash block chain.").arg(tr(PACKAGE_NAME)) + " " +
|
||||
storageRequiresMsg.arg(requiredSpace) + " " +
|
||||
@ -205,8 +203,15 @@ bool Intro::pickDataDirectory(interfaces::Node& node)
|
||||
|
||||
if(!fs::exists(GUIUtil::qstringToBoostPath(dataDir)) || gArgs.GetBoolArg("-choosedatadir", DEFAULT_CHOOSE_DATADIR) || dataDirDefaultCurrent != dataDirDefaultSettings)
|
||||
{
|
||||
/* Use selectParams here to guarantee Params() can be used by node interface */
|
||||
try {
|
||||
node.selectParams(gArgs.GetChainName());
|
||||
} catch (const std::exception&) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Let the user choose one */
|
||||
Intro intro;
|
||||
Intro intro(0, node.getAssumedChainStateSize(), node.getAssumedChainStateSize());
|
||||
GUIUtil::disableMacFocusRect(&intro);
|
||||
GUIUtil::loadStyleSheet(true);
|
||||
intro.setDataDirectory(dataDirDefaultCurrent);
|
||||
|
@ -30,7 +30,8 @@ class Intro : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Intro(QWidget *parent = 0);
|
||||
explicit Intro(QWidget *parent = 0,
|
||||
uint64_t blockchain_size = 0, uint64_t chain_state_size = 0);
|
||||
~Intro();
|
||||
|
||||
QString getDataDirectory();
|
||||
@ -71,6 +72,8 @@ private:
|
||||
QMutex mutex;
|
||||
bool signalled;
|
||||
QString pathToCheck;
|
||||
uint64_t m_blockchain_size;
|
||||
uint64_t m_chain_state_size;
|
||||
|
||||
void startThread();
|
||||
void checkPath(const QString &dataDir);
|
||||
|
Loading…
Reference in New Issue
Block a user