Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Result difficulty in RPC block_create #2752

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions nano/node/json_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,7 @@ void nano::json_handler::block_create ()
auto block_response_put_l = [rpc_l, this](nano::block const & block_a) {
boost::property_tree::ptree response_l;
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);
if (json_block_l)
{
Expand Down
2 changes: 2 additions & 0 deletions nano/rpc_test/rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5826,6 +5826,8 @@ TEST (rpc, block_create)
ASSERT_EQ (200, response.status);
std::string send_hash (response.json.get<std::string> ("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"));
boost::property_tree::ptree block_l;
std::stringstream block_stream (send_text);
Expand Down