diff --git a/external/silkworm b/external/silkworm index d3e6ead..67e0299 160000 --- a/external/silkworm +++ b/external/silkworm @@ -1 +1 @@ -Subproject commit d3e6ead809e9a5049d169d5eb8dfb0fa86d98db2 +Subproject commit 67e02993a67b2597375913e97b9d3a8da9473c1c diff --git a/src/engine_plugin.cpp b/src/engine_plugin.cpp index 96d7cda..c6e5f4f 100644 --- a/src/engine_plugin.cpp +++ b/src/engine_plugin.cpp @@ -73,12 +73,11 @@ class engine_plugin_impl : std::enable_shared_from_this { tid = std::this_thread::get_id(); const auto data_path = std::filesystem::path(node_settings.data_directory->chaindata().path().string()); - if ( std::filesystem::exists(data_path) ) { - node_settings.chaindata_env_config.shared = true; - } else { + // We do not set shared flag as node suppose to be the only writter to the db. + // There should be any valid case to use the shared flag here with our current design. + if ( !std::filesystem::exists(data_path) ) { node_settings.chaindata_env_config.create = true; } - db_env = silkworm::db::open_env(node_settings.chaindata_env_config); SILK_INFO << "Created DB environment at location : " << node_settings.data_directory->chaindata().path().string(); diff --git a/src/rpc_plugin.cpp b/src/rpc_plugin.cpp index 4796c79..9301446 100644 --- a/src/rpc_plugin.cpp +++ b/src/rpc_plugin.cpp @@ -34,7 +34,8 @@ void rpc_plugin::set_program_options( appbase::options_description& cli, appbase "number of threads for use with rpc") ("chaindata", boost::program_options::value()->default_value("./"), "directory of chaindata") - ("rpc-max-readers", boost::program_options::value()->default_value(16), + // use the value of silkworm::rpc::kDatabaseMaxReaders so we have the same setting between and after the fix + ("rpc-max-readers", boost::program_options::value()->default_value(32000), "maximum number of rpc readers") ("api-spec", boost::program_options::value()->default_value("eth"), "comma separated api spec, possible values: debug,engine,eth,net,parity,erigon,txpool,trace,web3") @@ -84,30 +85,6 @@ void rpc_plugin::plugin_initialize( const appbase::variables_map& options ) try const auto& data_dir = options.at("chaindata").as(); auto log_level = appbase::app().get_plugin().get_verbosity(); - using evmc::operator""_bytes32; - - uint32_t chain_id = options.at("chain-id").as(); - const auto chain_info = silkworm::lookup_known_chain(chain_id); - if (!chain_info) { - throw std::runtime_error{"unknown chain ID: " + std::to_string(chain_id)}; - } - silkworm::ChainConfig config = *(chain_info->second); - - silkworm::NodeSettings node_settings; - node_settings.data_directory = std::make_unique(data_dir, false); - node_settings.network_id = config.chain_id; - node_settings.chaindata_env_config = {node_settings.data_directory->chaindata().path().string(), false, true, false, false, true}; - - // bool create{false}; // Whether db file must be created - // bool readonly{false}; // Whether db should be opened in RO mode - // bool exclusive{false}; // Whether this process has exclusive access - // bool inmemory{false}; // Whether this db is in memory - // bool shared{false}; // Whether this process opens a db already opened by another process - // bool read_ahead{false}; // Whether to enable mdbx read ahead - // bool write_map{false}; // Whether to enable mdbx write map - - node_settings.chaindata_env_config.max_readers = max_readers; - node_settings.chain_config = config; silkworm::log::Settings log_settings{ .log_verbosity = log_level @@ -125,7 +102,8 @@ void rpc_plugin::plugin_initialize( const appbase::variables_map& options ) try .private_api_addr = node_port, .num_workers = threads, .skip_protocol_check = true, - .rpc_quirk_flag = rpc_quirk_flag + .rpc_quirk_flag = rpc_quirk_flag, + .max_readers = max_readers }; my.reset(new rpc_plugin_impl(settings));