diff --git a/nano/node/json_handler.cpp b/nano/node/json_handler.cpp index 76ba7c08..2e2e03cd 100644 --- a/nano/node/json_handler.cpp +++ b/nano/node/json_handler.cpp @@ -2547,6 +2547,7 @@ void nano::json_handler::account_history () entry.put ("local_timestamp", std::to_string (block->sideband ().timestamp)); entry.put ("height", std::to_string (block->sideband ().height)); entry.put ("hash", hash.to_string ()); + entry.put ("confirmed", node.ledger.block_confirmed (transaction, hash)); if (output_raw) { entry.put ("work", nano::to_string_hex (block->block_work ())); diff --git a/nano/rpc_test/rpc.cpp b/nano/rpc_test/rpc.cpp index 4b4f070c..a5d70dd9 100644 --- a/nano/rpc_test/rpc.cpp +++ b/nano/rpc_test/rpc.cpp @@ -1164,11 +1164,11 @@ TEST (rpc, account_history) request.put ("account", nano::dev::genesis->account ().to_account ()); request.put ("count", 100); auto response (wait_response (system, rpc, request, 10s)); - std::vector> history_l; + std::vector> history_l; auto & history_node (response.get_child ("history")); for (auto i (history_node.begin ()), n (history_node.end ()); i != n; ++i) { - history_l.push_back (std::make_tuple (i->second.get ("type"), i->second.get ("account"), i->second.get ("amount"), i->second.get ("hash"), i->second.get ("height"))); + history_l.push_back (std::make_tuple (i->second.get ("type"), i->second.get ("account"), i->second.get ("amount"), i->second.get ("hash"), i->second.get ("height"), i->second.get ("confirmed"))); } ASSERT_EQ (5, history_l.size ()); @@ -1177,26 +1177,31 @@ TEST (rpc, account_history) ASSERT_EQ (nano::dev::genesis_key.pub.to_account (), std::get<1> (history_l[0])); ASSERT_EQ (nano::Gxrb_ratio.convert_to (), std::get<2> (history_l[0])); ASSERT_EQ ("6", std::get<4> (history_l[0])); // change block (height 7) is skipped by account_history since "raw" is not set + ASSERT_FALSE (std::get<5> (history_l[0])); ASSERT_EQ ("send", std::get<0> (history_l[1])); ASSERT_EQ (usend.hash ().to_string (), std::get<3> (history_l[1])); ASSERT_EQ (nano::dev::genesis_key.pub.to_account (), std::get<1> (history_l[1])); ASSERT_EQ (nano::Gxrb_ratio.convert_to (), std::get<2> (history_l[1])); ASSERT_EQ ("5", std::get<4> (history_l[1])); + ASSERT_FALSE (std::get<5> (history_l[1])); ASSERT_EQ ("receive", std::get<0> (history_l[2])); ASSERT_EQ (nano::dev::genesis_key.pub.to_account (), std::get<1> (history_l[2])); ASSERT_EQ (node0->config.receive_minimum.to_string_dec (), std::get<2> (history_l[2])); ASSERT_EQ (receive->hash ().to_string (), std::get<3> (history_l[2])); ASSERT_EQ ("4", std::get<4> (history_l[2])); + ASSERT_FALSE (std::get<5> (history_l[2])); ASSERT_EQ ("send", std::get<0> (history_l[3])); ASSERT_EQ (nano::dev::genesis_key.pub.to_account (), std::get<1> (history_l[3])); ASSERT_EQ (node0->config.receive_minimum.to_string_dec (), std::get<2> (history_l[3])); ASSERT_EQ (send->hash ().to_string (), std::get<3> (history_l[3])); ASSERT_EQ ("3", std::get<4> (history_l[3])); + ASSERT_FALSE (std::get<5> (history_l[3])); ASSERT_EQ ("receive", std::get<0> (history_l[4])); ASSERT_EQ (nano::dev::genesis_key.pub.to_account (), std::get<1> (history_l[4])); ASSERT_EQ (nano::dev::constants.genesis_amount.convert_to (), std::get<2> (history_l[4])); ASSERT_EQ (nano::dev::genesis->hash ().to_string (), std::get<3> (history_l[4])); ASSERT_EQ ("1", std::get<4> (history_l[4])); // change block (height 2) is skipped + ASSERT_TRUE (std::get<5> (history_l[4])); } // Test count and reverse {