Output error message with qt wallet if RocksDB is enabled but node is not built with it (#2340)

This commit is contained in:
Wesley Shillingford 2019-10-15 09:23:07 +01:00 committed by GitHub
commit 43161cfec9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 1 deletions

View file

@ -250,6 +250,8 @@ std::string nano::error_config_messages::message (int ev) const
return "Invalid configuration value";
case nano::error_config::missing_value:
return "Missing value in configuration";
case nano::error_config::rocksdb_enabled_but_not_supported:
return "RocksDB has been enabled, but the node has not been built with RocksDB support. Set the CMake flag -DNANO_ROCKSDB=ON";
}
return "Invalid error code";

View file

@ -139,6 +139,7 @@ enum class error_config
generic = 1,
invalid_value,
missing_value,
rocksdb_enabled_but_not_supported
};
} // nano namespace

View file

@ -66,6 +66,13 @@ int run_wallet (QApplication & application, int argc, char * const * argv, boost
error = read_and_update_wallet_config (wallet_config, data_path);
}
#if !NANO_ROCKSDB
if (!error && config.node.rocksdb_config.enable)
{
error = nano::error_config::rocksdb_enabled_but_not_supported;
}
#endif
if (!error)
{
nano::set_use_memory_pools (config.node.use_memory_pools);

View file

@ -1372,7 +1372,7 @@ std::unique_ptr<nano::block_store> nano::make_store (nano::logger_mt & logger, b
#if NANO_ROCKSDB
return make_rocksdb ();
#else
// Can only use the rocksdb_store if the node has been build with rocksdb support
logger.always_log (std::error_code (nano::error_config::rocksdb_enabled_but_not_supported).message ());
release_assert (false);
return nullptr;
#endif