Result difficulty in RPC block_create (#2752)
This commit is contained in:
parent
5af4a2e613
commit
28b8ece8c4
2 changed files with 3 additions and 0 deletions
|
|
@ -1370,6 +1370,7 @@ void nano::json_handler::block_create ()
|
||||||
auto block_response_put_l = [rpc_l, this](nano::block const & block_a) {
|
auto block_response_put_l = [rpc_l, this](nano::block const & block_a) {
|
||||||
boost::property_tree::ptree response_l;
|
boost::property_tree::ptree response_l;
|
||||||
response_l.put ("hash", block_a.hash ().to_string ());
|
response_l.put ("hash", block_a.hash ().to_string ());
|
||||||
|
response_l.put ("difficulty", nano::to_string_hex (block_a.difficulty ()));
|
||||||
bool json_block_l = request.get<bool> ("json_block", false);
|
bool json_block_l = request.get<bool> ("json_block", false);
|
||||||
if (json_block_l)
|
if (json_block_l)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5826,6 +5826,8 @@ TEST (rpc, block_create)
|
||||||
ASSERT_EQ (200, response.status);
|
ASSERT_EQ (200, response.status);
|
||||||
std::string send_hash (response.json.get<std::string> ("hash"));
|
std::string send_hash (response.json.get<std::string> ("hash"));
|
||||||
ASSERT_EQ (send.hash ().to_string (), send_hash);
|
ASSERT_EQ (send.hash ().to_string (), send_hash);
|
||||||
|
std::string send_difficulty (response.json.get<std::string> ("difficulty"));
|
||||||
|
ASSERT_EQ (nano::to_string_hex (send.difficulty ()), send_difficulty);
|
||||||
auto send_text (response.json.get<std::string> ("block"));
|
auto send_text (response.json.get<std::string> ("block"));
|
||||||
boost::property_tree::ptree block_l;
|
boost::property_tree::ptree block_l;
|
||||||
std::stringstream block_stream (send_text);
|
std::stringstream block_stream (send_text);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue