From 8a20fd2bc84d74917381fb50362b4d1a385256bd Mon Sep 17 00:00:00 2001 From: jeffro256 Date: Wed, 22 Apr 2026 00:27:53 -0500 Subject: blockchain_utilities: fix --data-dir option --- src/cryptonote_core/cryptonote_core.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/cryptonote_core/cryptonote_core.cpp') diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index 4bada999f..18625de98 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -346,13 +346,21 @@ namespace cryptonote BlockchainDB::init_options(desc); } //----------------------------------------------------------------------------------------------- + network_type core::get_network_type_from_args(const boost::program_options::variables_map& vm) + { + const bool testnet = command_line::get_arg(vm, arg_testnet_on); + const bool stagenet = command_line::get_arg(vm, arg_stagenet_on); + const bool regtest = command_line::get_arg(vm, arg_regtest_on); + if (testnet + stagenet + regtest > 1) + throw std::runtime_error("More than one network type argument was specified"); + return testnet ? TESTNET : stagenet ? STAGENET : regtest ? FAKECHAIN : MAINNET; + } + //----------------------------------------------------------------------------------------------- bool core::handle_command_line(const boost::program_options::variables_map& vm) { if (m_nettype != FAKECHAIN) { - const bool testnet = command_line::get_arg(vm, arg_testnet_on); - const bool stagenet = command_line::get_arg(vm, arg_stagenet_on); - m_nettype = testnet ? TESTNET : stagenet ? STAGENET : MAINNET; + m_nettype = get_network_type_from_args(vm); } m_config_folder = command_line::get_arg(vm, arg_data_dir); -- cgit v1.2.3