From 19ec824da26065350db1fea5dd7c47bbef6e750b Mon Sep 17 00:00:00 2001 From: clemahieu Date: Fri, 8 Apr 2016 20:24:36 -0500 Subject: [PATCH] Fixing node and wallet config versioning. --- rai/rai_node/daemon.cpp | 2 +- rai/rai_node/daemon.hpp | 1 - rai/rai_wallet/entry.cpp | 9 ++++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/rai/rai_node/daemon.cpp b/rai/rai_node/daemon.cpp index ecb6fd48..c74b59f4 100644 --- a/rai/rai_node/daemon.cpp +++ b/rai/rai_node/daemon.cpp @@ -13,7 +13,7 @@ opencl_enable (false) void rai_daemon::daemon_config::serialize_json (boost::property_tree::ptree & tree_a) { - tree_a.put ("version", version); + tree_a.put ("version", "2"); tree_a.put ("rpc_enable", rpc_enable); boost::property_tree::ptree rpc_l; rpc.serialize_json (rpc_l); diff --git a/rai/rai_node/daemon.hpp b/rai/rai_node/daemon.hpp index 3b1279c5..ba6694d7 100644 --- a/rai/rai_node/daemon.hpp +++ b/rai/rai_node/daemon.hpp @@ -15,7 +15,6 @@ namespace rai_daemon bool deserialize_json (bool &, boost::property_tree::ptree &); void serialize_json (boost::property_tree::ptree &); bool upgrade_json (unsigned, boost::property_tree::ptree &); - unsigned version; bool rpc_enable; rai::rpc_config rpc; rai::node_config node; diff --git a/rai/rai_wallet/entry.cpp b/rai/rai_wallet/entry.cpp index 06833821..ae9bd81b 100644 --- a/rai/rai_wallet/entry.cpp +++ b/rai/rai_wallet/entry.cpp @@ -88,12 +88,15 @@ public: auto & node_l (tree_a.get_child ("node")); rpc_enable = tree_a.get ("rpc_enable"); auto & rpc_l (tree_a.get_child ("rpc")); + opencl_enable = tree_a.get ("opencl_enable"); + auto & opencl_l (tree_a.get_child ("opencl")); try { error |= wallet.decode_hex (wallet_l); error |= account.decode_account (account_l); error |= node.deserialize_json (upgraded_a, node_l); error |= rpc.deserialize_json (rpc_l); + error |= opencl.deserialize_json (opencl_l); if (wallet.is_zero ()) { rai::random_pool.GenerateBlock (wallet.bytes.data (), wallet.bytes.size ()); @@ -116,7 +119,7 @@ public: { std::string wallet_string; wallet.encode_hex (wallet_string); - tree_a.put ("version", "3"); + tree_a.put ("version", "4"); tree_a.put ("wallet", wallet_string); tree_a.put ("account", account.to_account ()); boost::property_tree::ptree node_l; @@ -126,6 +129,10 @@ public: rpc.serialize_json (rpc_l); tree_a.add_child ("rpc", rpc_l); tree_a.put ("rpc_enable", rpc_enable); + tree_a.put ("opencl_enable", opencl_enable); + boost::property_tree::ptree opencl_l; + opencl.serialize_json (opencl_l); + tree_a.add_child ("opencl", opencl_l); } bool serialize_json_stream (std::ostream & stream_a) {