From 257077a96bf44dcc2b70f1c4aedf312ae6c826d5 Mon Sep 17 00:00:00 2001 From: Zachary Michaels Date: Mon, 8 Sep 2014 13:40:28 -0400 Subject: [PATCH] Separate network id for testnet --- src/daemon/daemon.cpp | 6 +++++- src/p2p/net_node.h | 12 ++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/daemon/daemon.cpp b/src/daemon/daemon.cpp index 04f6db4fa..113b2c5dc 100644 --- a/src/daemon/daemon.cpp +++ b/src/daemon/daemon.cpp @@ -42,6 +42,7 @@ using namespace epee; #include "crypto/hash.h" #include "console_handler.h" #include "p2p/net_node.h" +#include "cryptonote_config.h" #include "cryptonote_core/checkpoints_create.h" #include "cryptonote_core/cryptonote_core.h" #include "rpc/core_rpc_server.h" @@ -202,7 +203,10 @@ int main(int argc, char* argv[]) } cryptonote::t_cryptonote_protocol_handler cprotocol(ccore, NULL); - nodetool::node_server > p2psrv(cprotocol); + nodetool::node_server > p2psrv { + cprotocol + , testnet_mode ? std::move(config::testnet::NETWORK_ID) : std::move(config::NETWORK_ID) + }; cryptonote::core_rpc_server rpc_server(ccore, p2psrv); cprotocol.set_p2p_endpoint(&p2psrv); ccore.set_cryptonote_protocol(&cprotocol); diff --git a/src/p2p/net_node.h b/src/p2p/net_node.h index 7030d93f7..759b21fcf 100644 --- a/src/p2p/net_node.h +++ b/src/p2p/net_node.h @@ -41,6 +41,7 @@ #include #include #include +#include #include "cryptonote_config.h" #include "warnings.h" @@ -78,8 +79,15 @@ namespace nodetool public: typedef t_payload_net_handler payload_net_handler; - // Some code - node_server(t_payload_net_handler& payload_handler):m_payload_handler(payload_handler), m_allow_local_ip(false), m_hide_my_port(false), m_network_id(::config::NETWORK_ID) + + node_server( + t_payload_net_handler& payload_handler + , boost::uuids::uuid network_id + ) + : m_payload_handler(payload_handler) + , m_allow_local_ip(false) + , m_hide_my_port(false) + , m_network_id(std::move(network_id)) {} static void init_options(boost::program_options::options_description& desc);