Browse Source

Merge pull request #1978 from sipa/nodetach

Remove -detachdb and stop's detach argument.
0.8
Pieter Wuille 12 years ago
parent
commit
b41de54a2c
  1. 8
      src/bitcoinrpc.cpp
  2. 20
      src/db.cpp
  3. 3
      src/db.h
  4. 3
      src/init.cpp
  5. 2
      src/qt/bitcoinstrings.cpp
  6. 10
      src/qt/forms/optionsdialog.ui
  7. 1
      src/qt/optionsdialog.cpp
  8. 10
      src/qt/optionsmodel.cpp
  9. 1
      src/qt/optionsmodel.h

8
src/bitcoinrpc.cpp

@ -179,14 +179,12 @@ Value help(const Array& params, bool fHelp)
Value stop(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) if (fHelp || params.size() > 1)
throw runtime_error( throw runtime_error(
"stop <detach>\n" "stop\n"
"<detach> is true or false to detach the database or not for this stop only\n" "Stop Bitcoin server.");
"Stop Bitcoin server (and possibly override the detachdb config value).");
// Shutdown will take long enough that the response should get back // Shutdown will take long enough that the response should get back
if (params.size() > 0)
bitdb.SetDetach(params[0].get_bool());
StartShutdown(); StartShutdown();
return "Bitcoin server stopping"; return "Bitcoin server stopping";
} }

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() void CDB::Flush()
{ {
if (activeTxn) if (activeTxn)
@ -288,10 +280,6 @@ void CDB::Flush()
unsigned int nMinutes = 0; unsigned int nMinutes = 0;
if (fReadOnly) if (fReadOnly)
nMinutes = 1; 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); bitdb.dbenv.txn_checkpoint(nMinutes ? GetArg("-dblogsize", 100)*1024 : 0, nMinutes, 0);
} }
@ -453,11 +441,9 @@ void CDBEnv::Flush(bool fShutdown)
CloseDb(strFile); CloseDb(strFile);
printf("%s checkpoint\n", strFile.c_str()); printf("%s checkpoint\n", strFile.c_str());
dbenv.txn_checkpoint(0, 0, 0); dbenv.txn_checkpoint(0, 0, 0);
if (!IsChainFile(strFile) || fDetachDB) { printf("%s detach\n", strFile.c_str());
printf("%s detach\n", strFile.c_str()); if (!fMockDb)
if (!fMockDb) dbenv.lsn_reset(strFile.c_str(), 0);
dbenv.lsn_reset(strFile.c_str(), 0);
}
printf("%s closed\n", strFile.c_str()); printf("%s closed\n", strFile.c_str());
mapFileUseCount.erase(mi++); mapFileUseCount.erase(mi++);
} }

3
src/db.h

@ -31,7 +31,6 @@ bool BackupWallet(const CWallet& wallet, const std::string& strDest);
class CDBEnv class CDBEnv
{ {
private: private:
bool fDetachDB;
bool fDbEnvInit; bool fDbEnvInit;
bool fMockDb; bool fMockDb;
boost::filesystem::path pathEnv; boost::filesystem::path pathEnv;
@ -71,8 +70,6 @@ public:
void Close(); void Close();
void Flush(bool fShutdown); void Flush(bool fShutdown);
void CheckpointLSN(std::string strFile); void CheckpointLSN(std::string strFile);
void SetDetach(bool fDetachDB_) { fDetachDB = fDetachDB_; }
bool GetDetach() { return fDetachDB; }
void CloseDb(const std::string& strFile); void CloseDb(const std::string& strFile);
bool RemoveDb(const std::string& strFile); bool RemoveDb(const std::string& strFile);

3
src/init.cpp

@ -264,7 +264,6 @@ std::string HelpMessage()
" -upnp " + _("Use UPnP to map the listening port (default: 0)") + "\n" + " -upnp " + _("Use UPnP to map the listening port (default: 0)") + "\n" +
#endif #endif
#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" + " -paytxfee=<amt> " + _("Fee per KB to add to transactions you send") + "\n" +
#ifdef QT_GUI #ifdef QT_GUI
" -server " + _("Accept command line and JSON-RPC commands") + "\n" + " -server " + _("Accept command line and JSON-RPC commands") + "\n" +
@ -407,8 +406,6 @@ bool AppInit2()
else else
fDebugNet = GetBoolArg("-debugnet"); fDebugNet = GetBoolArg("-debugnet");
bitdb.SetDetach(GetBoolArg("-detachdb", false));
#if !defined(WIN32) && !defined(QT_GUI) #if !defined(WIN32) && !defined(QT_GUI)
fDaemon = GetBoolArg("-daemon"); fDaemon = GetBoolArg("-daemon");
#else #else

2
src/qt/bitcoinstrings.cpp

@ -27,8 +27,6 @@ QT_TRANSLATE_NOOP("bitcoin-core", ""
"Cannot obtain a lock on data directory %s. Bitcoin is probably already " "Cannot obtain a lock on data directory %s. Bitcoin is probably already "
"running."), "running."),
QT_TRANSLATE_NOOP("bitcoin-core", "" 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 " "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 " "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."), "and coins were spent in the copy but not marked as spent here."),

10
src/qt/forms/optionsdialog.ui

@ -86,16 +86,6 @@
</property> </property>
</widget> </widget>
</item> </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>&amp;Detach databases at shutdown</string>
</property>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer_Main"> <spacer name="verticalSpacer_Main">
<property name="orientation"> <property name="orientation">

1
src/qt/optionsdialog.cpp

@ -128,7 +128,6 @@ void OptionsDialog::setMapper()
/* Main */ /* Main */
mapper->addMapping(ui->transactionFee, OptionsModel::Fee); mapper->addMapping(ui->transactionFee, OptionsModel::Fee);
mapper->addMapping(ui->bitcoinAtStartup, OptionsModel::StartAtStartup); mapper->addMapping(ui->bitcoinAtStartup, OptionsModel::StartAtStartup);
mapper->addMapping(ui->detachDatabases, OptionsModel::DetachDatabases);
/* Network */ /* Network */
mapper->addMapping(ui->mapPortUpnp, OptionsModel::MapPortUPnP); mapper->addMapping(ui->mapPortUpnp, OptionsModel::MapPortUPnP);

10
src/qt/optionsmodel.cpp

@ -56,8 +56,6 @@ void OptionsModel::Init()
SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString()); SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString());
if (settings.contains("nSocksVersion") && settings.value("fUseProxy").toBool()) if (settings.contains("nSocksVersion") && settings.value("fUseProxy").toBool())
SoftSetArg("-socks", settings.value("nSocksVersion").toString().toStdString()); SoftSetArg("-socks", settings.value("nSocksVersion").toString().toStdString());
if (settings.contains("detachDB"))
SoftSetBoolArg("-detachdb", settings.value("detachDB").toBool());
if (!language.isEmpty()) if (!language.isEmpty())
SoftSetArg("-lang", language.toStdString()); SoftSetArg("-lang", language.toStdString());
} }
@ -173,8 +171,6 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
return QVariant(nDisplayUnit); return QVariant(nDisplayUnit);
case DisplayAddresses: case DisplayAddresses:
return QVariant(bDisplayAddresses); return QVariant(bDisplayAddresses);
case DetachDatabases:
return QVariant(bitdb.GetDetach());
case Language: case Language:
return settings.value("language", ""); return settings.value("language", "");
default: default:
@ -256,12 +252,6 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
bDisplayAddresses = value.toBool(); bDisplayAddresses = value.toBool();
settings.setValue("bDisplayAddresses", bDisplayAddresses); settings.setValue("bDisplayAddresses", bDisplayAddresses);
break; break;
case DetachDatabases: {
bool fDetachDB = value.toBool();
bitdb.SetDetach(fDetachDB);
settings.setValue("detachDB", fDetachDB);
}
break;
case Language: case Language:
settings.setValue("language", value); settings.setValue("language", value);
break; break;

1
src/qt/optionsmodel.h

@ -28,7 +28,6 @@ public:
Fee, // qint64 Fee, // qint64
DisplayUnit, // BitcoinUnits::Unit DisplayUnit, // BitcoinUnits::Unit
DisplayAddresses, // bool DisplayAddresses, // bool
DetachDatabases, // bool
Language, // QString Language, // QString
OptionIDRowCount, OptionIDRowCount,
}; };

Loading…
Cancel
Save