aboutsummaryrefslogtreecommitdiff
path: root/src/daemon
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon')
-rw-r--r--src/daemon/CMakeLists.txt2
-rw-r--r--src/daemon/command_parser_executor.cpp6
-rw-r--r--src/daemon/command_server.cpp2
-rw-r--r--src/daemon/core.h15
-rw-r--r--src/daemon/daemon.cpp1
-rw-r--r--src/daemon/executor.h1
-rw-r--r--src/daemon/main.cpp1
-rw-r--r--src/daemon/rpc_command_executor.cpp2
8 files changed, 22 insertions, 8 deletions
diff --git a/src/daemon/CMakeLists.txt b/src/daemon/CMakeLists.txt
index 2f9c2b2f9..ad84db450 100644
--- a/src/daemon/CMakeLists.txt
+++ b/src/daemon/CMakeLists.txt
@@ -59,7 +59,6 @@ set(daemon_private_headers
rpc_command_executor.h
# cryptonote_protocol
- ../cryptonote_protocol/blobdatatype.h
../cryptonote_protocol/cryptonote_protocol_defs.h
../cryptonote_protocol/cryptonote_protocol_handler.h
../cryptonote_protocol/cryptonote_protocol_handler.inl
@@ -67,7 +66,6 @@ set(daemon_private_headers
# p2p
../p2p/net_node.h
- ../p2p/net_node.inl
../p2p/net_node_common.h
../p2p/net_peerlist.h
../p2p/net_peerlist_boost_serialization.h
diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp
index 5307b2472..8970f9407 100644
--- a/src/daemon/command_parser_executor.cpp
+++ b/src/daemon/command_parser_executor.cpp
@@ -173,7 +173,7 @@ bool t_command_parser_executor::print_block(const std::vector<std::string>& args
uint64_t height = boost::lexical_cast<uint64_t>(arg);
return m_executor.print_block_by_height(height);
}
- catch (boost::bad_lexical_cast&)
+ catch (const boost::bad_lexical_cast&)
{
crypto::hash block_hash;
if (parse_hash256(arg, block_hash))
@@ -420,7 +420,7 @@ bool t_command_parser_executor::out_peers(const std::vector<std::string>& args)
limit = std::stoi(args[0]);
}
- catch(std::exception& ex) {
+ catch(const std::exception& ex) {
_erro("stoi exception");
return false;
}
@@ -450,7 +450,7 @@ bool t_command_parser_executor::hard_fork_info(const std::vector<std::string>& a
try {
version = std::stoi(args[0]);
}
- catch(std::exception& ex) {
+ catch(const std::exception& ex) {
return false;
}
if (version <= 0 || version > 255)
diff --git a/src/daemon/command_server.cpp b/src/daemon/command_server.cpp
index 7ff6b2bf3..ecf58e22c 100644
--- a/src/daemon/command_server.cpp
+++ b/src/daemon/command_server.cpp
@@ -26,8 +26,10 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#include <boost/algorithm/string.hpp>
#include "cryptonote_config.h"
#include "version.h"
+#include "string_tools.h"
#include "daemon/command_server.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
diff --git a/src/daemon/core.h b/src/daemon/core.h
index 9e6ff5e29..97f1cb8c1 100644
--- a/src/daemon/core.h
+++ b/src/daemon/core.h
@@ -67,11 +67,24 @@ public:
m_core.set_cryptonote_protocol(&protocol);
}
+ std::string get_config_subdir() const
+ {
+ bool testnet = command_line::get_arg(m_vm_HACK, cryptonote::arg_testnet_on);
+ auto p2p_bind_arg = testnet ? nodetool::arg_testnet_p2p_bind_port : nodetool::arg_p2p_bind_port;
+ std::string port = command_line::get_arg(m_vm_HACK, p2p_bind_arg);
+ if ((!testnet && port != std::to_string(::config::P2P_DEFAULT_PORT))
+ || (testnet && port != std::to_string(::config::testnet::P2P_DEFAULT_PORT))) {
+ return port;
+ }
+ return std::string();
+ }
+
bool run()
{
//initialize core here
MGINFO("Initializing core...");
- if (!m_core.init(m_vm_HACK))
+ std::string config_subdir = get_config_subdir();
+ if (!m_core.init(m_vm_HACK, config_subdir.empty() ? NULL : config_subdir.c_str()))
{
return false;
}
diff --git a/src/daemon/daemon.cpp b/src/daemon/daemon.cpp
index f8acf1357..3bc6ea392 100644
--- a/src/daemon/daemon.cpp
+++ b/src/daemon/daemon.cpp
@@ -30,6 +30,7 @@
#include <memory>
#include <stdexcept>
+#include <boost/algorithm/string/split.hpp>
#include "misc_log_ex.h"
#include "daemon/daemon.h"
#include "rpc/daemon_handler.h"
diff --git a/src/daemon/executor.h b/src/daemon/executor.h
index 137e7209c..35c9e9b47 100644
--- a/src/daemon/executor.h
+++ b/src/daemon/executor.h
@@ -32,7 +32,6 @@
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/variables_map.hpp>
#include <string>
-#include <vector>
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "daemon"
diff --git a/src/daemon/main.cpp b/src/daemon/main.cpp
index d038cc825..6ac47fcb2 100644
--- a/src/daemon/main.cpp
+++ b/src/daemon/main.cpp
@@ -44,6 +44,7 @@
#include "rpc/rpc_args.h"
#include "daemon/command_line_args.h"
#include "blockchain_db/db_types.h"
+#include "version.h"
#ifdef STACK_TRACE
#include "common/stack_trace.h"
diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp
index d7ee28baa..8aca668ad 100644
--- a/src/daemon/rpc_command_executor.cpp
+++ b/src/daemon/rpc_command_executor.cpp
@@ -1611,7 +1611,7 @@ bool t_rpc_command_executor::alt_chain_info()
}
tools::msg_writer() << boost::lexical_cast<std::string>(res.chains.size()) << " alternate chains found:";
- for (const auto chain: res.chains)
+ for (const auto &chain: res.chains)
{
uint64_t start_height = (chain.height - chain.length + 1);
tools::msg_writer() << chain.length << " blocks long, from height " << start_height << " (" << (ires.height - start_height - 1)