diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h index 25fd1caa..6035288c 100644 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -8,7 +8,7 @@ #define CRYPTONOTE_MAX_BLOCK_SIZE 500000000 // block header blob limit, never used! #define CRYPTONOTE_MAX_TX_SIZE 1000000000 #define CRYPTONOTE_PUBLIC_ADDRESS_TEXTBLOB_VER 0 -//TODO Define the first letter of your currency address +//TODO Currency-specific address prefix #define CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX //TODO Choose maturity period for your currency #define CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW diff --git a/src/cryptonote_core/blockchain_storage.cpp b/src/cryptonote_core/blockchain_storage.cpp index fb0663f7..87d53c02 100755 --- a/src/cryptonote_core/blockchain_storage.cpp +++ b/src/cryptonote_core/blockchain_storage.cpp @@ -80,7 +80,7 @@ uint64_t blockchain_storage::get_current_blockchain_height() { return m_blocks.size(); } -bool blockchain_storage::init(const std::string& config_folder, bool load_existing) { +bool blockchain_storage::init(const std::string& config_folder, bool load_existing, bool testnet) { CRITICAL_REGION_LOCAL(m_blockchain_lock); if (!config_folder.empty() && !tools::create_directories_if_necessary(config_folder)) { LOG_ERROR("Failed to create data directory: " << m_config_folder); @@ -149,11 +149,24 @@ bool blockchain_storage::init(const std::string& config_folder, bool load_existi if (m_blocks.empty()) { LOG_PRINT_L0("Blockchain not loaded, generating genesis block."); - block bl = ::boost::value_initialized(); - block_verification_context bvc = boost::value_initialized(); - generate_genesis_block(bl); - add_new_block(bl, bvc); - CHECK_AND_ASSERT_MES(!bvc.m_verifivation_failed, false, "Failed to add genesis block to blockchain"); + + if (!storeGenesisBlock(testnet)) { + return false; + } + } else { + cryptonote::block b; + if (testnet) { + generateTestnetGenesisBlock(b); + } else { + generateGenesisBlock(b); + } + + crypto::hash genesis_hash = get_block_hash(m_blocks[0].bl); + crypto::hash testnet_genesis_hash = get_block_hash(b); + if (genesis_hash != testnet_genesis_hash) { + LOG_ERROR("Failed to init: genesis block mismatch. Probably you set --testnet flag with data dir with non-test blockchain or another network."); + return false; + } } uint64_t timestamp_diff = time(NULL) - m_blocks.back().bl.timestamp; @@ -163,6 +176,21 @@ bool blockchain_storage::init(const std::string& config_folder, bool load_existi return true; } +bool blockchain_storage::storeGenesisBlock(bool testnet) { + block bl = ::boost::value_initialized(); + block_verification_context bvc = boost::value_initialized(); + + if (testnet) { + generateTestnetGenesisBlock(bl); + } else { + generateGenesisBlock(bl); + } + + add_new_block(bl, bvc); + CHECK_AND_ASSERT_MES(!bvc.m_verifivation_failed, false, "Failed to add genesis block to blockchain"); + return true; +} + bool blockchain_storage::store_blockchain() { try { std::ofstream file(appendPath(m_config_folder, CRYPTONOTE_BLOCKSCACHE_FILENAME), std::ios::binary); diff --git a/src/cryptonote_core/blockchain_storage.h b/src/cryptonote_core/blockchain_storage.h index a67cf520..e8946865 100755 --- a/src/cryptonote_core/blockchain_storage.h +++ b/src/cryptonote_core/blockchain_storage.h @@ -18,7 +18,7 @@ namespace cryptonote { {}; bool init() { return init(tools::get_default_data_dir(), true); } - bool init(const std::string& config_folder, bool load_existing); + bool init(const std::string& config_folder, bool load_existing, bool testnet = false); bool deinit(); void set_checkpoints(checkpoints&& chk_pts) { m_checkpoints = chk_pts; } @@ -182,6 +182,7 @@ namespace cryptonote { bool pushTransaction(Block& block, const crypto::hash& transactionHash, TransactionIndex transactionIndex); void popTransaction(const transaction& transaction, const crypto::hash& transactionHash); void popTransactions(const Block& block, const crypto::hash& minerTransactionHash); + bool storeGenesisBlock(bool testnet); }; diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index 5c456d41..6065eafd 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -90,14 +90,14 @@ namespace cryptonote return m_blockchain_storage.get_alternative_blocks_count(); } //----------------------------------------------------------------------------------------------- - bool core::init(const boost::program_options::variables_map& vm, bool load_existing) + bool core::init(const boost::program_options::variables_map& vm, bool load_existing, bool testnet) { bool r = handle_command_line(vm); r = m_mempool.init(m_config_folder); CHECK_AND_ASSERT_MES(r, false, "Failed to initialize memory pool"); - r = m_blockchain_storage.init(m_config_folder, load_existing); + r = m_blockchain_storage.init(m_config_folder, load_existing, testnet); CHECK_AND_ASSERT_MES(r, false, "Failed to initialize blockchain storage"); r = m_miner.init(vm); diff --git a/src/cryptonote_core/cryptonote_core.h b/src/cryptonote_core/cryptonote_core.h index b573438d..921f83f2 100644 --- a/src/cryptonote_core/cryptonote_core.h +++ b/src/cryptonote_core/cryptonote_core.h @@ -43,7 +43,7 @@ namespace cryptonote miner& get_miner(){return m_miner;} static void init_options(boost::program_options::options_description& desc); - bool init(const boost::program_options::variables_map& vm, bool load_existing); + bool init(const boost::program_options::variables_map& vm, bool load_existing, bool testnet); bool set_genesis_block(const block& b); bool deinit(); uint64_t get_current_blockchain_height(); diff --git a/src/cryptonote_core/cryptonote_format_utils.cpp b/src/cryptonote_core/cryptonote_format_utils.cpp index afd5b9fd..a44b060d 100644 --- a/src/cryptonote_core/cryptonote_format_utils.cpp +++ b/src/cryptonote_core/cryptonote_format_utils.cpp @@ -617,7 +617,7 @@ namespace cryptonote return p; } //--------------------------------------------------------------- - bool generate_genesis_block(block& bl) + bool generateGenesisBlock(block& bl) { //genesis block bl = boost::value_initialized(); @@ -630,7 +630,7 @@ namespace cryptonote construct_miner_tx(0, 0, 0, 0, 0, ac, bl.miner_tx); // zero fee in genesis blobdata txb = tx_to_blob(bl.miner_tx); std::string hex_tx_represent = string_tools::buff_to_hex_nodelimer(txb); - std::cout << "Genesis coinbase tx hex: " << hex_to_represent << std::endl; + std::cout << "Genesis coinbase tx hex: " << hex_tx_represent << std::endl; */ //hard code coinbase tx in genesis block, because "true" generating tx use random, but genesis should be always the same @@ -648,6 +648,16 @@ namespace cryptonote //miner::find_nonce_for_given_block(bl, 1, 0); return true; } + + bool generateTestnetGenesisBlock(cryptonote::block& b) { + if (!generateGenesisBlock(b)) { + return false; + } + + b.nonce += 1; + return true; + } + //--------------------------------------------------------------- bool get_block_longhash(crypto::cn_context &context, const block& b, crypto::hash& res, uint64_t height) { diff --git a/src/cryptonote_core/cryptonote_format_utils.h b/src/cryptonote_core/cryptonote_format_utils.h index d3c08980..9477e1a6 100644 --- a/src/cryptonote_core/cryptonote_format_utils.h +++ b/src/cryptonote_core/cryptonote_format_utils.h @@ -79,7 +79,8 @@ namespace cryptonote crypto::hash get_block_hash(const block& b); bool get_block_longhash(crypto::cn_context &context, const block& b, crypto::hash& res, uint64_t height); crypto::hash get_block_longhash(crypto::cn_context &context, const block& b, uint64_t height); - bool generate_genesis_block(block& bl); + bool generateGenesisBlock(block& bl); + bool generateTestnetGenesisBlock(block& bl); bool parse_and_validate_block_from_blob(const blobdata& b_blob, block& b); bool get_inputs_money_amount(const transaction& tx, uint64_t& money); uint64_t get_outs_money_amount(const transaction& tx); diff --git a/src/daemon/daemon.cpp b/src/daemon/daemon.cpp index b86edd1b..660cb784 100644 --- a/src/daemon/daemon.cpp +++ b/src/daemon/daemon.cpp @@ -36,6 +36,8 @@ namespace const command_line::arg_descriptor arg_log_file = {"log-file", "", ""}; const command_line::arg_descriptor arg_log_level = {"log-level", "", LOG_LEVEL_0}; const command_line::arg_descriptor arg_console = {"no-console", "Disable daemon console commands"}; + const command_line::arg_descriptor arg_testnet_on = {"testnet", "Used to deploy test nets. Checkpoints and hardcoded seeds are ignored, " + "network id is changed. Use it with --data-dir flag. The wallet must be launched with --testnet flag.", false}; } bool command_line_preprocessor(const boost::program_options::variables_map& vm); @@ -66,7 +68,7 @@ int main(int argc, char* argv[]) command_line::add_arg(desc_cmd_sett, arg_log_file); command_line::add_arg(desc_cmd_sett, arg_log_level); command_line::add_arg(desc_cmd_sett, arg_console); - + command_line::add_arg(desc_cmd_sett, arg_testnet_on); cryptonote::core::init_options(desc_cmd_sett); cryptonote::core_rpc_server::init_options(desc_cmd_sett); @@ -134,7 +136,14 @@ int main(int argc, char* argv[]) //create objects and link them cryptonote::core ccore(NULL); - ccore.set_checkpoints(std::move(checkpoints)); + + bool testnet_mode = command_line::get_arg(vm, arg_testnet_on); + if (testnet_mode) { + LOG_PRINT_L0("Starting in testnet mode!"); + } else { + ccore.set_checkpoints(std::move(checkpoints)); + } + cryptonote::t_cryptonote_protocol_handler cprotocol(ccore, NULL); nodetool::node_server > p2psrv(cprotocol); cryptonote::core_rpc_server rpc_server(ccore, p2psrv); @@ -144,7 +153,7 @@ int main(int argc, char* argv[]) //initialize objects LOG_PRINT_L0("Initializing p2p server..."); - res = p2psrv.init(vm); + res = p2psrv.init(vm, testnet_mode); CHECK_AND_ASSERT_MES(res, 1, "Failed to initialize p2p server."); LOG_PRINT_L0("P2p server initialized OK"); @@ -160,7 +169,7 @@ int main(int argc, char* argv[]) //initialize core here LOG_PRINT_L0("Initializing core..."); - res = ccore.init(vm, true); + res = ccore.init(vm, true, testnet_mode); CHECK_AND_ASSERT_MES(res, 1, "Failed to initialize core"); LOG_PRINT_L0("Core initialized OK"); diff --git a/src/p2p/net_node.h b/src/p2p/net_node.h index 74b9490f..05fe1b04 100644 --- a/src/p2p/net_node.h +++ b/src/p2p/net_node.h @@ -53,13 +53,13 @@ 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) + 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(CRYPTONOTE_NETWORK) {} static void init_options(boost::program_options::options_description& desc); bool run(); - bool init(const boost::program_options::variables_map& vm); + bool init(const boost::program_options::variables_map& vm, bool testnet); bool deinit(); bool send_stop_signal(); uint32_t get_this_peer_port(){return m_listenning_port;} @@ -203,6 +203,7 @@ namespace nodetool uint64_t m_peer_livetime; //keep connections to initiate some interactions net_server m_net_server; + boost::uuids::uuid m_network_id; }; } diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index 89ae6ddd..00f98524 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -50,7 +50,8 @@ namespace nodetool command_line::add_arg(desc, arg_p2p_add_priority_node); command_line::add_arg(desc, arg_p2p_add_exclusive_node); command_line::add_arg(desc, arg_p2p_seed_node); - command_line::add_arg(desc, arg_p2p_hide_my_port); } + command_line::add_arg(desc, arg_p2p_hide_my_port); + } //----------------------------------------------------------------------------------- template bool node_server::init_config() @@ -191,10 +192,14 @@ namespace nodetool #define ADD_HARDCODED_SEED_NODE(addr) append_net_address(m_seed_nodes, addr); //----------------------------------------------------------------------------------- template - bool node_server::init(const boost::program_options::variables_map& vm) + bool node_server::init(const boost::program_options::variables_map& vm, bool testnet) { - //TODO add seed for your network - //ADD_HARDCODED_SEED_NODE("your_seed_ip.com:8080"); + if (!testnet) { + //TODO add seed for your network + //ADD_HARDCODED_SEED_NODE("your_seed_ip.com:8080"); + } else { + m_network_id.data[0] += 1; + } bool res = handle_command_line(vm); CHECK_AND_ASSERT_MES(res, false, "Failed to handle command line"); @@ -368,7 +373,7 @@ namespace nodetool return; } - if(rsp.node_data.network_id != CRYPTONOTE_NETWORK) + if(rsp.node_data.network_id != m_network_id) { LOG_ERROR_CCONTEXT("COMMAND_HANDSHAKE Failed, wrong network! (" << epee::string_tools::get_str_from_guid_a(rsp.node_data.network_id) << "), closing connection."); return; @@ -776,7 +781,7 @@ namespace nodetool node_data.my_port = m_external_port ? m_external_port : m_listenning_port; else node_data.my_port = 0; - node_data.network_id = CRYPTONOTE_NETWORK; + node_data.network_id = m_network_id; return true; } //----------------------------------------------------------------------------------- @@ -996,9 +1001,8 @@ namespace nodetool template int node_server::handle_handshake(int command, typename COMMAND_HANDSHAKE::request& arg, typename COMMAND_HANDSHAKE::response& rsp, p2p_connection_context& context) { - if(arg.node_data.network_id != CRYPTONOTE_NETWORK) + if(arg.node_data.network_id != m_network_id) { - LOG_PRINT_CCONTEXT_L0("WRONG NETWORK AGENT CONNECTED! id=" << epee::string_tools::get_str_from_guid_a(arg.node_data.network_id)); drop_connection(context); return 1; diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index b01c8d2d..f9c59851 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -40,6 +40,7 @@ namespace const command_line::arg_descriptor arg_password = {"password", "Wallet password", "", true}; const command_line::arg_descriptor arg_daemon_port = {"daemon-port", "Use daemon instance at port instead of 8081", 0}; const command_line::arg_descriptor arg_log_level = {"set_log", "", 0, true}; + const command_line::arg_descriptor arg_testnet = {"testnet", "Used to deploy test nets. The daemon must be launched with --testnet flag", false}; const command_line::arg_descriptor< std::vector > arg_command = {"command", ""}; @@ -266,6 +267,8 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm) if (m_daemon_address.empty()) m_daemon_address = std::string("http://") + m_daemon_host + ":" + std::to_string(m_daemon_port); + bool testnet = command_line::get_arg(vm, arg_testnet); + tools::password_container pwd_container; if (command_line::has_arg(vm, arg_password)) { @@ -283,12 +286,12 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm) if (!m_generate_new.empty()) { - bool r = new_wallet(m_generate_new, pwd_container.password()); + bool r = new_wallet(m_generate_new, pwd_container.password(), testnet); CHECK_AND_ASSERT_MES(r, false, "account creation failed"); } else { - bool r = open_wallet(m_wallet_file, pwd_container.password()); + bool r = open_wallet(m_wallet_file, pwd_container.password(), testnet); CHECK_AND_ASSERT_MES(r, false, "could not open account"); } @@ -324,11 +327,11 @@ bool simple_wallet::try_connect_to_daemon() return true; } //---------------------------------------------------------------------------------------------------- -bool simple_wallet::new_wallet(const string &wallet_file, const std::string& password) +bool simple_wallet::new_wallet(const string &wallet_file, const std::string& password, bool testnet) { m_wallet_file = wallet_file; - m_wallet.reset(new tools::wallet2()); + m_wallet.reset(new tools::wallet2(testnet)); m_wallet->callback(this); try { @@ -355,10 +358,10 @@ bool simple_wallet::new_wallet(const string &wallet_file, const std::string& pas return true; } //---------------------------------------------------------------------------------------------------- -bool simple_wallet::open_wallet(const string &wallet_file, const std::string& password) +bool simple_wallet::open_wallet(const string &wallet_file, const std::string& password, bool testnet) { m_wallet_file = wallet_file; - m_wallet.reset(new tools::wallet2()); + m_wallet.reset(new tools::wallet2(testnet)); m_wallet->callback(this); try @@ -899,6 +902,7 @@ int main(int argc, char* argv[]) command_line::add_arg(desc_params, arg_daemon_port); command_line::add_arg(desc_params, arg_command); command_line::add_arg(desc_params, arg_log_level); + command_line::add_arg(desc_params, arg_testnet); tools::wallet_rpc_server::init_options(desc_params); po::positional_options_description positional_options; @@ -914,7 +918,7 @@ int main(int argc, char* argv[]) if (command_line::get_arg(vm, command_line::arg_help)) { - success_msg_writer() << "bytecoin wallet v" << PROJECT_VERSION_LONG; + success_msg_writer() << CRYPTONOTE_NAME " wallet v" << PROJECT_VERSION_LONG; success_msg_writer() << "Usage: simplewallet [--wallet-file=|--generate-new-wallet=] [--daemon-address=:] []"; success_msg_writer() << desc_all << '\n' << w.get_commands_str(); return false; @@ -968,6 +972,7 @@ int main(int argc, char* argv[]) return 1; } + bool testnet = command_line::get_arg(vm, arg_testnet); std::string wallet_file = command_line::get_arg(vm, arg_wallet_file); std::string wallet_password = command_line::get_arg(vm, arg_password); std::string daemon_address = command_line::get_arg(vm, arg_daemon_address); @@ -980,7 +985,7 @@ int main(int argc, char* argv[]) if (daemon_address.empty()) daemon_address = std::string("http://") + daemon_host + ":" + std::to_string(daemon_port); - tools::wallet2 wal; + tools::wallet2 wal(testnet); try { LOG_PRINT_L0("Loading wallet..."); diff --git a/src/simplewallet/simplewallet.h b/src/simplewallet/simplewallet.h index 0d2b4d5c..95fdecfa 100644 --- a/src/simplewallet/simplewallet.h +++ b/src/simplewallet/simplewallet.h @@ -39,8 +39,8 @@ namespace cryptonote bool run_console_handler(); - bool new_wallet(const std::string &wallet_file, const std::string& password); - bool open_wallet(const std::string &wallet_file, const std::string& password); + bool new_wallet(const std::string &wallet_file, const std::string& password, bool testnet); + bool open_wallet(const std::string &wallet_file, const std::string& password, bool testnet); bool close_wallet(); bool help(const std::vector &args = std::vector()); diff --git a/src/version.h.in b/src/version.h.in index 62316da3..7812a19d 100644 --- a/src/version.h.in +++ b/src/version.h.in @@ -1,4 +1,4 @@ #define BUILD_COMMIT_ID "@VERSION@" -#define PROJECT_VERSION "0.8.11" -#define PROJECT_VERSION_BUILD_NO "65" +#define PROJECT_VERSION "1.0.0" +#define PROJECT_VERSION_BUILD_NO "1" #define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO "(" BUILD_COMMIT_ID ")" diff --git a/src/wallet/Wallet.cpp b/src/wallet/Wallet.cpp index a327e1a2..15e790cd 100644 --- a/src/wallet/Wallet.cpp +++ b/src/wallet/Wallet.cpp @@ -106,7 +106,7 @@ void Wallet::initAndGenerate(const std::string& password) { void Wallet::storeGenesisBlock() { cryptonote::block b; - cryptonote::generate_genesis_block(b); + cryptonote::generateGenesisBlock(b); m_blockchain.push_back(get_block_hash(b)); } diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 5cfe5d72..4f323eb8 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -373,9 +373,6 @@ bool wallet2::clear() { m_blockchain.clear(); m_transfers.clear(); - cryptonote::block b; - cryptonote::generate_genesis_block(b); - m_blockchain.push_back(get_block_hash(b)); m_local_bc_height = 1; return true; } @@ -455,6 +452,10 @@ void wallet2::generate(const std::string& wallet_, const std::string& password) r = file_io_utils::save_string_to_file(m_wallet_file + ".address.txt", m_account.get_public_address_str()); if(!r) LOG_PRINT_RED_L0("String with address text not saved"); + cryptonote::block b; + generateGenesis(b); + m_blockchain.push_back(get_block_hash(b)); + store(); } //---------------------------------------------------------------------------------------------------- @@ -527,15 +528,25 @@ void wallet2::load(const std::string& wallet_, const std::string& password) m_account_public_address.m_view_public_key != m_account.get_keys().m_account_address.m_view_public_key, error::wallet_files_doesnt_correspond, m_keys_file, m_wallet_file); - if(m_blockchain.empty()) - { - cryptonote::block b; - cryptonote::generate_genesis_block(b); - m_blockchain.push_back(get_block_hash(b)); + cryptonote::block genesis; + generateGenesis(genesis); + crypto::hash genesisHash = get_block_hash(genesis); + + if (m_blockchain.empty()) { + m_blockchain.push_back(genesisHash); + } else { + checkGenesis(genesisHash); } + m_local_bc_height = m_blockchain.size(); } //---------------------------------------------------------------------------------------------------- +void wallet2::checkGenesis(const crypto::hash& genesisHash) { + std::string what("Genesis block missmatch. You probably use wallet without testnet flag with blockchain from test network or vice versa"); + + THROW_WALLET_EXCEPTION_IF(genesisHash != m_blockchain[0], error::wallet_internal_error, what); +} +//---------------------------------------------------------------------------------------------------- void wallet2::store() { bool r = tools::serialize_obj_to_file(*this, m_wallet_file); @@ -690,4 +701,12 @@ void wallet2::transfer(const std::vector& dsts transfer(dsts, fake_outputs_count, unlock_time, fee, extra, tx); } //---------------------------------------------------------------------------------------------------- +void wallet2::generateGenesis(cryptonote::block& b) { + if (m_testnet) { + cryptonote::generateTestnetGenesisBlock(b); + } else { + cryptonote::generateGenesisBlock(b); + } +} +//---------------------------------------------------------------------------------------------------- } diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index 778e1766..e1d4dd10 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -53,9 +53,9 @@ namespace tools class wallet2 { - wallet2(const wallet2&) : m_run(true), m_callback(0) {}; + wallet2(const wallet2&) : m_run(true), m_callback(0), m_testnet(false) {}; public: - wallet2() : m_run(true), m_callback(0) {}; + wallet2(bool testnet = false) : m_run(true), m_callback(0), m_testnet(testnet) {}; struct transfer_details { uint64_t m_block_height; @@ -162,6 +162,8 @@ namespace tools bool prepare_file_names(const std::string& file_path); void process_unconfirmed(const cryptonote::transaction& tx); void add_unconfirmed_tx(const cryptonote::transaction& tx, uint64_t change_amount); + void generateGenesis(cryptonote::block& b); + void checkGenesis(const crypto::hash& genesis_hash); //throws cryptonote::account_base m_account; std::string m_daemon_address; @@ -181,6 +183,7 @@ namespace tools std::atomic m_run; i_wallet2_callback* m_callback; + bool m_testnet; }; } BOOST_CLASS_VERSION(tools::wallet2, 7) diff --git a/tests/core_proxy/core_proxy.cpp b/tests/core_proxy/core_proxy.cpp index d3ff7444..25b66486 100644 --- a/tests/core_proxy/core_proxy.cpp +++ b/tests/core_proxy/core_proxy.cpp @@ -86,7 +86,7 @@ int main(int argc, char* argv[]) //initialize objects LOG_PRINT_L0("Initializing p2p server..."); - bool res = p2psrv.init(vm); + bool res = p2psrv.init(vm, false); CHECK_AND_ASSERT_MES(res, 1, "Failed to initialize p2p server."); LOG_PRINT_L0("P2p server initialized OK"); @@ -198,7 +198,7 @@ bool tests::proxy_core::get_blockchain_top(uint64_t& height, crypto::hash& top_i } bool tests::proxy_core::init(const boost::program_options::variables_map& /*vm*/) { - generate_genesis_block(m_genesis); + generateGenesisBlock(m_genesis); crypto::hash h = get_block_hash(m_genesis); add_block(h, get_block_longhash(m_cn_context, m_genesis, 0), m_genesis, block_to_blob(m_genesis)); return true; diff --git a/tests/core_tests/chaingen.h b/tests/core_tests/chaingen.h index 2350c931..773b11c0 100644 --- a/tests/core_tests/chaingen.h +++ b/tests/core_tests/chaingen.h @@ -461,7 +461,7 @@ inline bool do_replay_events(std::vector& events) cryptonote::cryptonote_protocol_stub pr; //TODO: stub only for this kind of test, make real validation of relayed objects cryptonote::core c(&pr); - if (!c.init(vm, false)) + if (!c.init(vm, false, false)) { std::cout << concolor::magenta << "Failed to init core" << concolor::normal << std::endl; return false;