Toggle SAFE syncmode on and off automatically
If monerod is started with default sync mode, set it to SAFE after synchronization completes. Set it back to FAST if synchronization restarts (e.g. because another peer has a longer blockchain). If monerod is started with an explicit sync mode, none of this automation takes effect.
This commit is contained in:
@@ -1318,6 +1318,11 @@ void BlockchainLMDB::sync()
|
||||
}
|
||||
}
|
||||
|
||||
void BlockchainLMDB::safesyncmode(const bool onoff)
|
||||
{
|
||||
mdb_env_set_flags(m_env, MDB_NOSYNC|MDB_MAPASYNC, !onoff);
|
||||
}
|
||||
|
||||
void BlockchainLMDB::reset()
|
||||
{
|
||||
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
|
||||
|
||||
@@ -165,6 +165,8 @@ public:
|
||||
|
||||
virtual void sync();
|
||||
|
||||
virtual void safesyncmode(const bool onoff);
|
||||
|
||||
virtual void reset();
|
||||
|
||||
virtual std::vector<std::string> get_filenames() const;
|
||||
|
||||
Reference in New Issue
Block a user