Permalink
Browse files

Merge rwconf_policy

  • Loading branch information...
2 parents 50c0c7f + 4aedd3e commit 8ead78789f0653f03c7bb142a301e7c19e3af29c @luke-jr luke-jr committed Feb 18, 2017
View
@@ -67,6 +67,7 @@
#endif
bool fFeeEstimatesInitialized = false;
+static const bool DEFAULT_COREPOLICY = false;
static const bool DEFAULT_PROXYRANDOMIZE = true;
static const bool DEFAULT_REST_ENABLE = false;
static const bool DEFAULT_DISABLE_SAFEMODE = false;
@@ -340,6 +341,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage +=HelpMessageOpt("-assumevalid=<hex>", strprintf(_("If this block is in the chain assume that it and its ancestors are valid and potentially skip their script verification (0 to verify all, default: %s, testnet: %s)"), Params(CBaseChainParams::MAIN).GetConsensus().defaultAssumeValid.GetHex(), Params(CBaseChainParams::TESTNET).GetConsensus().defaultAssumeValid.GetHex()));
strUsage += HelpMessageOpt("-conf=<file>", strprintf(_("Specify configuration file (default: %s)"), BITCOIN_CONF_FILENAME));
strUsage += HelpMessageOpt("-confrw=<file>", strprintf(_("Specify read/write configuration file (default: %s)"), BITCOIN_RW_CONF_FILENAME));
+ strUsage += HelpMessageOpt("-corepolicy", strprintf(_("Use Bitcoin Core policy defaults (default: %s)"), DEFAULT_COREPOLICY));
if (mode == HMM_BITCOIND)
{
#if HAVE_DECL_DAEMON
@@ -502,6 +504,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-blockmintxfee=<amt>", strprintf(_("Set lowest fee rate (in %s/kB) for transactions to be included in block creation. (default: %s)"), CURRENCY_UNIT, FormatMoney(DEFAULT_BLOCK_MIN_TX_FEE)));
if (showDebug)
strUsage += HelpMessageOpt("-blockversion=<n>", "Override block version to test forking scenarios");
+ strUsage += HelpMessageOpt("-priorityaccurate", strprintf(_("Update coin-age priority accurately when parent transactions are confirmed (default: %d)"), fPriorityAccurate));
#ifdef USE_LIBEVENT
strUsage += HelpMessageGroup(_("RPC server options:"));
@@ -739,6 +742,17 @@ bool AppInitServers(boost::thread_group& threadGroup)
// Parameter interaction based on rules
void InitParameterInteraction()
{
+ if (GetBoolArg("-corepolicy", DEFAULT_COREPOLICY)) {
+ SoftSetArg("-bytespersigopstrict", "0");
+ SoftSetArg("-spamfilter", "0");
+ SoftSetArg("-permitbaremultisig", "1");
+ SoftSetArg("-datacarriersize", "83");
+
+ SoftSetArg("-blockprioritysize", "0");
+ SoftSetArg("-priorityaccurate", "0");
+ SoftSetArg("-blockmaxsize", "750000");
+ }
+
// when specifying an explicit binding address, you want to listen on it
// even when -connect or -proxy is specified
if (IsArgSet("-bind")) {
@@ -921,6 +935,8 @@ bool AppInitParameterInteraction()
fDebug = false;
}
+ fPriorityAccurate = GetBoolArg("-priorityaccurate", fPriorityAccurate);
+
// Check for -debugnet
if (GetBoolArg("-debugnet", false))
InitWarning(_("Unsupported argument -debugnet ignored, use -debug=net."));
@@ -955,10 +971,10 @@ bool AppInitParameterInteraction()
LogPrintf("Validating signatures for all blocks.\n");
// mempool limits
- int64_t nMempoolSizeMax = GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000;
- int64_t nMempoolSizeMin = GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT) * 1000 * 40;
- if (nMempoolSizeMax < 0 || nMempoolSizeMax < nMempoolSizeMin)
- return InitError(strprintf(_("-maxmempool must be at least %d MB"), std::ceil(nMempoolSizeMin / 1000000.0)));
+ int64_t nMempoolSizeMaxMB = GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE);
+ int64_t nMempoolSizeMinMB = maxmempoolMinimum(GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT));
+ if (nMempoolSizeMaxMB < 0 || nMempoolSizeMaxMB < nMempoolSizeMinMB)
+ return InitError(strprintf(_("-maxmempool must be at least %d MB"), nMempoolSizeMinMB));
// incremental relay fee sets the minimimum feerate increase necessary for BIP 125 replacement in the mempool
// and the amount the mempool min fee increases above the feerate of txs evicted due to mempool limiting.
if (IsArgSet("-incrementalrelayfee"))
View
@@ -15,9 +15,9 @@
class CCoinsViewCache;
/** Default for -blockmaxsize, which controls the maximum size of block the mining code will create **/
-static const unsigned int DEFAULT_BLOCK_MAX_SIZE = 750000;
+static const unsigned int DEFAULT_BLOCK_MAX_SIZE = 500000;
/** Default for -blockprioritysize, maximum space for zero/low-fee transactions **/
-static const unsigned int DEFAULT_BLOCK_PRIORITY_SIZE = 0;
+static const unsigned int DEFAULT_BLOCK_PRIORITY_SIZE = 100000;
/** Default for -blockmaxweight, which controls the range of block weights the mining code will create **/
static const unsigned int DEFAULT_BLOCK_MAX_WEIGHT = 3000000;
/** Default for -blockmintxfee, which sets the minimum feerate for a transaction in blocks created by mining code **/
View
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>674</width>
- <height>415</height>
+ <height>447</height>
</rect>
</property>
<property name="windowTitle">
@@ -200,6 +200,40 @@
</item>
</layout>
</item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QCheckBox" name="chkPrune">
+ <property name="text">
+ <string>Limit block chain storage to</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="pruneMiB"/>
+ </item>
+ <item>
+ <widget class="QLabel" name="lblPruneSuffix">
+ <property name="buddy">
+ <cstring>pruneMiB</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
<item>
<widget class="QLabel" name="lblExplanation1">
<property name="text">
View
@@ -11,7 +11,9 @@
#include "guiutil.h"
+#include "consensus/consensus.h"
#include "util.h"
+#include "validation.h"
#include <boost/filesystem.hpp>
@@ -133,26 +135,55 @@ Intro::Intro(QWidget *parent) :
);
ui->lblExplanation2->setText(ui->lblExplanation2->text().arg(tr(PACKAGE_NAME)));
- uint64_t pruneTarget = std::max<int64_t>(0, GetArg("-prune", 0));
+ int minPruneTarget = std::ceil(MIN_DISK_SPACE_FOR_BLOCK_FILES / 1024.0 / 1024.0);
+ ui->pruneMiB->setMinimum(minPruneTarget);
+ ui->pruneMiB->setMaximum(std::numeric_limits<int>::max());
+
+ int64_t pruneTarget = GetArg("-prune", 0);
+ if (pruneTarget > 1) {
+ ui->chkPrune->setChecked(true);
+ ui->pruneMiB->setValue(pruneTarget);
+ } else {
+ ui->chkPrune->setChecked(false);
+ ui->pruneMiB->setValue(minPruneTarget);
+ }
+ connect(ui->chkPrune, SIGNAL(stateChanged(int)), this, SLOT(UpdateText()));
+ connect(ui->pruneMiB, SIGNAL(valueChanged(int)), this, SLOT(UpdateText()));
+
+ UpdateText();
+
+ startThread();
+}
+
+void Intro::UpdateText()
+{
requiredSpace = BLOCK_CHAIN_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);
+ uint64_t pruneBytes = uint64_t(ui->pruneMiB->value()) * 1024 * 1024;
+ if (ui->chkPrune->isChecked()) {
+ uint64_t prunedGBs = std::ceil(double(pruneBytes) / GB_BYTES);
if (prunedGBs <= requiredSpace) {
requiredSpace = prunedGBs;
storageRequiresMsg = tr("Approximately %1 GB of data will be stored in this directory.");
+ ui->lblExplanation3->setVisible(true);
+ } else {
+ ui->lblExplanation3->setVisible(false);
}
- ui->lblExplanation3->setVisible(true);
+ ui->pruneMiB->setEnabled(true);
} else {
ui->lblExplanation3->setVisible(false);
+ ui->pruneMiB->setEnabled(false);
}
+ static const uint64_t nPowTargetSpacing = 10 * 60; // from chainparams, which we don't have at this stage
+ // TODO: Bump this to 2-3 MB after segwit activates, based on real world changes
+ static const uint32_t nExpectedBlockDataSize = 1125000; // includes undo data
+ ui->lblPruneSuffix->setText(tr("MiB (sufficient to restore backups %n day(s) old)", "block chain pruning", pruneBytes / (uint64_t(nExpectedBlockDataSize) * 86400 / nPowTargetSpacing)));
requiredSpace += CHAIN_STATE_SIZE;
ui->sizeWarningLabel->setText(
tr("%1 will download and store a copy of the Bitcoin block chain.").arg(tr(PACKAGE_NAME)) + " " +
storageRequiresMsg.arg(requiredSpace) + " " +
tr("The wallet will also be stored in this directory.")
);
- startThread();
}
Intro::~Intro()
@@ -183,6 +214,15 @@ void Intro::setDataDirectory(const QString &dataDir)
}
}
+uint64_t Intro::getPrune()
+{
+ if (ui->chkPrune->isChecked()) {
+ return ui->pruneMiB->value();
+ } else {
+ return 0;
+ }
+}
+
QString Intro::getDefaultDataDirectory()
{
return GUIUtil::boostPathToQString(GetDefaultDataDir());
@@ -224,6 +264,14 @@ bool Intro::pickDataDirectory()
tr("Error: Specified data directory \"%1\" cannot be created.").arg(dataDir));
/* fall through, back to choosing screen */
}
+
+ int64_t introPrune = intro.getPrune();
+ if (introPrune || GetArg("-prune", 0) > 1) {
+ // Initialise specified prune setting
+ std::string strPrune = strprintf("%d", introPrune);
+ SetArg("-prune", strPrune);
+ ModifyRWConfigFile("prune", strPrune);
+ }
}
settings.setValue("strDataDir", dataDir);
View
@@ -31,6 +31,7 @@ class Intro : public QDialog
QString getDataDirectory();
void setDataDirectory(const QString &dataDir);
+ uint64_t getPrune();
/**
* Determine data directory. Let the user choose if the current one doesn't exist.
@@ -60,6 +61,7 @@ private Q_SLOTS:
void on_ellipsisButton_clicked();
void on_dataDirDefault_clicked();
void on_dataDirCustom_clicked();
+ void UpdateText();
private:
Ui::Intro *ui;
Oops, something went wrong.

0 comments on commit 8ead787

Please sign in to comment.