Directly putting pair in ptree result since a dot is a path delimiter and was creating nested structures.

This commit is contained in:
clemahieu 2017-08-25 11:05:05 -05:00
commit d268796623
2 changed files with 2 additions and 3 deletions

View file

@ -1221,6 +1221,7 @@ TEST (rpc, DISABLED_payment_wait)
TEST (rpc, peers)
{
rai::system system (24000, 2);
system.nodes [0]->peers.insert (rai::endpoint (boost::asio::ip::address_v6::from_string ("::ffff:80.80.80.80"), 4000), 1);
rai::rpc rpc (system.service, *system.nodes [0], rai::rpc_config (true));
rpc.start ();
boost::property_tree::ptree request;

View file

@ -1476,9 +1476,7 @@ void rai::rpc_handler::peers ()
{
std::stringstream text;
text << i->first;
boost::property_tree::ptree entry;
entry.put (text.str (), std::to_string (i->second));
peers_l.push_back (std::make_pair ("", entry));
peers_l.push_back (boost::property_tree::ptree::value_type (text.str (), boost::property_tree::ptree (std::to_string (i->second))));
}
response_l.add_child ("peers", peers_l);
response (response_l);