mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 02:25:40 +01:00
Merge pull request #1978 from sipa/nodetach
Remove -detachdb and stop's detach argument.
This commit is contained in:
commit
b41de54a2c
@ -179,14 +179,12 @@ Value help(const Array& params, bool fHelp)
|
||||
|
||||
Value stop(const Array& params, bool fHelp)
|
||||
{
|
||||
// Accept the deprecated and ignored 'detach´ boolean argument
|
||||
if (fHelp || params.size() > 1)
|
||||
throw runtime_error(
|
||||
"stop <detach>\n"
|
||||
"<detach> is true or false to detach the database or not for this stop only\n"
|
||||
"Stop Bitcoin server (and possibly override the detachdb config value).");
|
||||
"stop\n"
|
||||
"Stop Bitcoin server.");
|
||||
// Shutdown will take long enough that the response should get back
|
||||
if (params.size() > 0)
|
||||
bitdb.SetDetach(params[0].get_bool());
|
||||
StartShutdown();
|
||||
return "Bitcoin server stopping";
|
||||
}
|
||||
|
20
src/db.cpp
20
src/db.cpp
@ -271,14 +271,6 @@ CDB::CDB(const char *pszFile, const char* pszMode) :
|
||||
}
|
||||
}
|
||||
|
||||
static bool IsChainFile(std::string strFile)
|
||||
{
|
||||
if (strFile == "coins.dat" || strFile == "blktree.dat")
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CDB::Flush()
|
||||
{
|
||||
if (activeTxn)
|
||||
@ -288,10 +280,6 @@ void CDB::Flush()
|
||||
unsigned int nMinutes = 0;
|
||||
if (fReadOnly)
|
||||
nMinutes = 1;
|
||||
if (IsChainFile(strFile))
|
||||
nMinutes = 2;
|
||||
if (IsChainFile(strFile) && IsInitialBlockDownload())
|
||||
nMinutes = 5;
|
||||
|
||||
bitdb.dbenv.txn_checkpoint(nMinutes ? GetArg("-dblogsize", 100)*1024 : 0, nMinutes, 0);
|
||||
}
|
||||
@ -453,11 +441,9 @@ void CDBEnv::Flush(bool fShutdown)
|
||||
CloseDb(strFile);
|
||||
printf("%s checkpoint\n", strFile.c_str());
|
||||
dbenv.txn_checkpoint(0, 0, 0);
|
||||
if (!IsChainFile(strFile) || fDetachDB) {
|
||||
printf("%s detach\n", strFile.c_str());
|
||||
if (!fMockDb)
|
||||
dbenv.lsn_reset(strFile.c_str(), 0);
|
||||
}
|
||||
printf("%s detach\n", strFile.c_str());
|
||||
if (!fMockDb)
|
||||
dbenv.lsn_reset(strFile.c_str(), 0);
|
||||
printf("%s closed\n", strFile.c_str());
|
||||
mapFileUseCount.erase(mi++);
|
||||
}
|
||||
|
3
src/db.h
3
src/db.h
@ -31,7 +31,6 @@ bool BackupWallet(const CWallet& wallet, const std::string& strDest);
|
||||
class CDBEnv
|
||||
{
|
||||
private:
|
||||
bool fDetachDB;
|
||||
bool fDbEnvInit;
|
||||
bool fMockDb;
|
||||
boost::filesystem::path pathEnv;
|
||||
@ -71,8 +70,6 @@ public:
|
||||
void Close();
|
||||
void Flush(bool fShutdown);
|
||||
void CheckpointLSN(std::string strFile);
|
||||
void SetDetach(bool fDetachDB_) { fDetachDB = fDetachDB_; }
|
||||
bool GetDetach() { return fDetachDB; }
|
||||
|
||||
void CloseDb(const std::string& strFile);
|
||||
bool RemoveDb(const std::string& strFile);
|
||||
|
@ -264,7 +264,6 @@ std::string HelpMessage()
|
||||
" -upnp " + _("Use UPnP to map the listening port (default: 0)") + "\n" +
|
||||
#endif
|
||||
#endif
|
||||
" -detachdb " + _("Detach block and address databases. Increases shutdown time (default: 0)") + "\n" +
|
||||
" -paytxfee=<amt> " + _("Fee per KB to add to transactions you send") + "\n" +
|
||||
#ifdef QT_GUI
|
||||
" -server " + _("Accept command line and JSON-RPC commands") + "\n" +
|
||||
@ -407,8 +406,6 @@ bool AppInit2()
|
||||
else
|
||||
fDebugNet = GetBoolArg("-debugnet");
|
||||
|
||||
bitdb.SetDetach(GetBoolArg("-detachdb", false));
|
||||
|
||||
#if !defined(WIN32) && !defined(QT_GUI)
|
||||
fDaemon = GetBoolArg("-daemon");
|
||||
#else
|
||||
|
@ -27,8 +27,6 @@ QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Cannot obtain a lock on data directory %s. Bitcoin is probably already "
|
||||
"running."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Detach block and address databases. Increases shutdown time (default: 0)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Error: The transaction was rejected. This might happen if some of the coins "
|
||||
"in your wallet were already spent, such as if you used a copy of wallet.dat "
|
||||
"and coins were spent in the copy but not marked as spent here."),
|
||||
|
@ -86,16 +86,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="detachDatabases">
|
||||
<property name="toolTip">
|
||||
<string>Detach block and address databases at shutdown. This means they can be moved to another data directory, but it slows down shutdown. The wallet is always detached.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Detach databases at shutdown</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_Main">
|
||||
<property name="orientation">
|
||||
|
@ -128,7 +128,6 @@ void OptionsDialog::setMapper()
|
||||
/* Main */
|
||||
mapper->addMapping(ui->transactionFee, OptionsModel::Fee);
|
||||
mapper->addMapping(ui->bitcoinAtStartup, OptionsModel::StartAtStartup);
|
||||
mapper->addMapping(ui->detachDatabases, OptionsModel::DetachDatabases);
|
||||
|
||||
/* Network */
|
||||
mapper->addMapping(ui->mapPortUpnp, OptionsModel::MapPortUPnP);
|
||||
|
@ -56,8 +56,6 @@ void OptionsModel::Init()
|
||||
SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString());
|
||||
if (settings.contains("nSocksVersion") && settings.value("fUseProxy").toBool())
|
||||
SoftSetArg("-socks", settings.value("nSocksVersion").toString().toStdString());
|
||||
if (settings.contains("detachDB"))
|
||||
SoftSetBoolArg("-detachdb", settings.value("detachDB").toBool());
|
||||
if (!language.isEmpty())
|
||||
SoftSetArg("-lang", language.toStdString());
|
||||
}
|
||||
@ -173,8 +171,6 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
|
||||
return QVariant(nDisplayUnit);
|
||||
case DisplayAddresses:
|
||||
return QVariant(bDisplayAddresses);
|
||||
case DetachDatabases:
|
||||
return QVariant(bitdb.GetDetach());
|
||||
case Language:
|
||||
return settings.value("language", "");
|
||||
default:
|
||||
@ -256,12 +252,6 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
|
||||
bDisplayAddresses = value.toBool();
|
||||
settings.setValue("bDisplayAddresses", bDisplayAddresses);
|
||||
break;
|
||||
case DetachDatabases: {
|
||||
bool fDetachDB = value.toBool();
|
||||
bitdb.SetDetach(fDetachDB);
|
||||
settings.setValue("detachDB", fDetachDB);
|
||||
}
|
||||
break;
|
||||
case Language:
|
||||
settings.setValue("language", value);
|
||||
break;
|
||||
|
@ -28,7 +28,6 @@ public:
|
||||
Fee, // qint64
|
||||
DisplayUnit, // BitcoinUnits::Unit
|
||||
DisplayAddresses, // bool
|
||||
DetachDatabases, // bool
|
||||
Language, // QString
|
||||
OptionIDRowCount,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user