diff --git a/rai/cli/daemon.cpp b/rai/cli/daemon.cpp index 931870d4..7d7f28aa 100644 --- a/rai/cli/daemon.cpp +++ b/rai/cli/daemon.cpp @@ -6,6 +6,7 @@ #include rai_daemon::daemon_config::daemon_config () : +representative (rai::genesis_account), peering_port (24000), rpc_enable (false), rpc_address (boost::asio::ip::address_v6::loopback ()), @@ -18,6 +19,9 @@ rpc_enable_control (false) void rai_daemon::daemon_config::serialize (std::ostream & output_a) { boost::property_tree::ptree tree; + std::string representative_l; + representative.encode_base58check (representative_l); + tree.put ("representative", representative_l); tree.put ("peering_port", std::to_string (peering_port)); boost::property_tree::ptree bootstrap_peers_l; for (auto i (bootstrap_peers.begin ()), n (bootstrap_peers.end ()); i != n; ++i) @@ -41,6 +45,7 @@ rai_daemon::daemon_config::daemon_config (bool & error_a, std::istream & input_a try { boost::property_tree::read_json (input_a, tree); + auto representative_l (tree.get ("representative")); auto peering_port_l (tree.get ("peering_port")); auto rpc_address_l (tree.get ("rpc_address")); auto rpc_port_l (tree.get ("rpc_port")); @@ -68,6 +73,7 @@ rai_daemon::daemon_config::daemon_config (bool & error_a, std::istream & input_a { error_a = true; } + error_a = error_a | representative.decode_base58check (representative_l); } catch (std::runtime_error const &) { @@ -106,7 +112,7 @@ void rai_daemon::daemon::run () auto pool (boost::make_shared ()); rai::processor_service processor; rai::client_init init; - auto client (std::make_shared (init, service, config.peering_port, working / "data", processor, rai::genesis_account)); + auto client (std::make_shared (init, service, config.peering_port, working / "data", processor, config.representative)); if (!init.error ()) { client->processor.connect_bootstrap (config.bootstrap_peers); diff --git a/rai/cli/daemon.hpp b/rai/cli/daemon.hpp index 7f76ea4f..e87860eb 100644 --- a/rai/cli/daemon.hpp +++ b/rai/cli/daemon.hpp @@ -17,6 +17,7 @@ namespace rai_daemon daemon_config (); daemon_config (bool &, std::istream &); void serialize (std::ostream &); + rai::uint256_union representative; std::vector bootstrap_peers; uint16_t peering_port; bool rpc_enable; diff --git a/rai/qt_client/entry.cpp b/rai/qt_client/entry.cpp index e7e88464..da36920f 100644 --- a/rai/qt_client/entry.cpp +++ b/rai/qt_client/entry.cpp @@ -9,6 +9,7 @@ class qt_client_config { public: qt_client_config () : + representative (rai::genesis_account), peering_port (24000) { bootstrap_peers.push_back ("rai.raiblocks.net"); @@ -20,6 +21,7 @@ public: try { boost::property_tree::read_json (stream_a, tree); + auto representative_l (tree.get ("representative")); auto peering_port_l (tree.get ("peering_port")); auto bootstrap_peers_l (tree.get_child ("bootstrap_peers")); bootstrap_peers.clear (); @@ -37,6 +39,7 @@ public: { error_a = true; } + error_a = error_a | representative.decode_base58check (representative_l); } catch (std::runtime_error const &) { @@ -47,6 +50,9 @@ public: void serialize (std::ostream & stream_a) { boost::property_tree::ptree tree; + std::string representative_l; + representative.encode_base58check (representative_l); + tree.put ("representative", representative_l); tree.put ("peering_port", std::to_string (peering_port)); boost::property_tree::ptree bootstrap_peers_l; for (auto i (bootstrap_peers.begin ()), n (bootstrap_peers.end ()); i != n; ++i) @@ -58,6 +64,7 @@ public: tree.add_child ("bootstrap_peers", bootstrap_peers_l); boost::property_tree::write_json (stream_a, tree); } + rai::uint256_union representative; std::vector bootstrap_peers; uint16_t peering_port; }; @@ -89,7 +96,7 @@ int main (int argc, char ** argv) auto service (boost::make_shared ()); rai::processor_service processor; rai::client_init init; - auto client (std::make_shared (init, service, config.peering_port, boost::filesystem::system_complete (argv[0]).parent_path () / "data", processor, rai::genesis_account)); + auto client (std::make_shared (init, service, config.peering_port, boost::filesystem::system_complete (argv[0]).parent_path () / "data", processor, config.representative)); QObject::connect (&application, &QApplication::aboutToQuit, [&] () { client->stop ();