diff --git a/programs/eosio-launcher/main.cpp b/programs/eosio-launcher/main.cpp index ffac6afce10..18df7049759 100644 --- a/programs/eosio-launcher/main.cpp +++ b/programs/eosio-launcher/main.cpp @@ -322,6 +322,11 @@ struct last_run_def { }; +enum class p2p_plugin { + NET, + BNET +}; + enum launch_modes { LM_NONE, LM_LOCAL, @@ -345,6 +350,7 @@ struct launcher_def { size_t producers; size_t next_node; string shape; + p2p_plugin p2p; allowed_connection allowed_connections = PC_NONE; bfs::path genesis; bfs::path output; @@ -429,6 +435,7 @@ launcher_def::set_options (bpo::options_description &cfg) { ("producers",bpo::value(&producers)->default_value(21),"total number of non-bios producer instances in this network") ("mode,m",bpo::value>()->multitoken()->default_value({"any"}, "any"),"connection mode, combination of \"any\", \"producers\", \"specified\", \"none\"") ("shape,s",bpo::value(&shape)->default_value("star"),"network topology, use \"star\" \"mesh\" or give a filename for custom") + ("p2p-plugin", bpo::value()->default_value("net"),"select a p2p plugin to use (either net or bnet). Defaults to net.") ("genesis,g",bpo::value(&genesis)->default_value("./genesis.json"),"set the path to genesis.json") ("skip-signature", bpo::bool_switch(&skip_transaction_signatures)->default_value(false), "nodeos does not require transaction signatures.") ("nodeos", bpo::value(&eosd_extra_args), "forward nodeos command line argument(s) to each instance of nodeos, enclose arg in quotes") @@ -490,6 +497,20 @@ launcher_def::initialize (const variables_map &vmap) { host_map_file = src.stem().string() + "_hosts.json"; } + string nc = vmap["p2p-plugin"].as(); + if ( !nc.empty() ) { + if (boost::iequals(nc,"net")) + p2p = p2p_plugin::NET; + else if (boost::iequals(nc,"bnet")) + p2p = p2p_plugin::BNET; + else { + p2p = p2p_plugin::NET; + } + } + else { + p2p = p2p_plugin::NET; + } + if( !host_map_file.empty() ) { try { fc::json::from_file(host_map_file).as>(bindings); @@ -962,8 +983,14 @@ launcher_def::write_config_file (tn_node_def &node) { cfg << "readonly = 0\n"; cfg << "send-whole-blocks = true\n"; cfg << "http-server-address = " << host->host_name << ":" << instance.http_port << "\n"; - cfg << "p2p-listen-endpoint = " << host->listen_addr << ":" << instance.p2p_port << "\n"; - cfg << "p2p-server-address = " << host->public_name << ":" << instance.p2p_port << "\n"; + if (p2p == p2p_plugin::NET) { + cfg << "p2p-listen-endpoint = " << host->listen_addr << ":" << instance.p2p_port << "\n"; + cfg << "p2p-server-address = " << host->public_name << ":" << instance.p2p_port << "\n"; + } else { + cfg << "bnet-endpoint = " << host->listen_addr << ":" << instance.p2p_port << "\n"; + // Include the net_plugin endpoint, because the plugin is always loaded (even if not used). + cfg << "p2p-listen-endpoint = " << host->listen_addr << ":" << instance.p2p_port + 1000 << "\n"; + } if (is_bios) { cfg << "enable-stale-production = true\n"; @@ -989,10 +1016,18 @@ launcher_def::write_config_file (tn_node_def &node) { if(!is_bios) { auto &bios_node = network.nodes["bios"]; - cfg << "p2p-peer-address = " << bios_node.instance->p2p_endpoint<< "\n"; + if (p2p == p2p_plugin::NET) { + cfg << "p2p-peer-address = " << bios_node.instance->p2p_endpoint<< "\n"; + } else { + cfg << "bnet-connect = " << bios_node.instance->p2p_endpoint<< "\n"; + } } for (const auto &p : node.peers) { - cfg << "p2p-peer-address = " << network.nodes.find(p)->second.instance->p2p_endpoint << "\n"; + if (p2p == p2p_plugin::NET) { + cfg << "p2p-peer-address = " << network.nodes.find(p)->second.instance->p2p_endpoint << "\n"; + } else { + cfg << "bnet-connect = " << network.nodes.find(p)->second.instance->p2p_endpoint << "\n"; + } } if (instance.has_db || node.producers.size()) { cfg << "required-participation = 33\n"; @@ -1008,6 +1043,11 @@ launcher_def::write_config_file (tn_node_def &node) { if( instance.has_db ) { cfg << "plugin = eosio::mongo_db_plugin\n"; } + if ( p2p == p2p_plugin::NET ) { + cfg << "plugin = eosio::net_plugin\n"; + } else { + cfg << "plugin = eosio::bnet_plugin\n"; + } cfg << "plugin = eosio::chain_api_plugin\n" << "plugin = eosio::history_api_plugin\n"; cfg.close(); @@ -1813,6 +1853,7 @@ int main (int argc, char *argv[]) { cfg, true), vmap); + if (vmap.count("launch")) { string l = vmap["launch"].as(); if (boost::iequals(l,"all"))