* Fix RPC "active_difficulty" returning empty string as "difficulty_trend" (#3323) * Change active_difficulty test unit accordingly
This commit is contained in:
parent
77dae8a7c1
commit
baa7f4386a
2 changed files with 9 additions and 3 deletions
|
|
@ -1024,8 +1024,14 @@ void nano::json_handler::active_difficulty ()
|
||||||
response_l.put ("multiplier", 1.0);
|
response_l.put ("multiplier", 1.0);
|
||||||
if (include_trend)
|
if (include_trend)
|
||||||
{
|
{
|
||||||
boost::property_tree::ptree trend_entry_l;
|
boost::property_tree::ptree difficulty_trend_l;
|
||||||
response_l.add_child ("difficulty_trend", trend_entry_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 ();
|
response_errors ();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7159,7 +7159,7 @@ TEST (rpc, active_difficulty)
|
||||||
auto trend_opt (response.json.get_child_optional ("difficulty_trend"));
|
auto trend_opt (response.json.get_child_optional ("difficulty_trend"));
|
||||||
ASSERT_TRUE (trend_opt.is_initialized ());
|
ASSERT_TRUE (trend_opt.is_initialized ());
|
||||||
auto & trend (trend_opt.get ());
|
auto & trend (trend_opt.get ());
|
||||||
ASSERT_EQ (0, trend.size ());
|
ASSERT_EQ (1, trend.size ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue