diff --git a/nano/node/json_handler.cpp b/nano/node/json_handler.cpp index a3833b5c..c9c804cf 100644 --- a/nano/node/json_handler.cpp +++ b/nano/node/json_handler.cpp @@ -1024,8 +1024,14 @@ void nano::json_handler::active_difficulty () response_l.put ("multiplier", 1.0); if (include_trend) { - boost::property_tree::ptree trend_entry_l; - response_l.add_child ("difficulty_trend", trend_entry_l); + boost::property_tree::ptree difficulty_trend_l; + + // To keep this RPC backwards-compatible + boost::property_tree::ptree entry; + entry.put ("", "1.000000000000000"); + difficulty_trend_l.push_back (std::make_pair ("", entry)); + + response_l.add_child ("difficulty_trend", difficulty_trend_l); } response_errors (); } diff --git a/nano/rpc_test/rpc.cpp b/nano/rpc_test/rpc.cpp index e2df5e74..00c9d8c8 100644 --- a/nano/rpc_test/rpc.cpp +++ b/nano/rpc_test/rpc.cpp @@ -7159,7 +7159,7 @@ TEST (rpc, active_difficulty) auto trend_opt (response.json.get_child_optional ("difficulty_trend")); ASSERT_TRUE (trend_opt.is_initialized ()); auto & trend (trend_opt.get ()); - ASSERT_EQ (0, trend.size ()); + ASSERT_EQ (1, trend.size ()); } }