diff --git a/nano/core_test/rpc.cpp b/nano/core_test/rpc.cpp index 2e896c0ea4..caed4360dd 100644 --- a/nano/core_test/rpc.cpp +++ b/nano/core_test/rpc.cpp @@ -4221,7 +4221,7 @@ TEST (rpc, wallet_history) auto & history_node (response.json.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 ("wallet_account"), i->second.get ("local_timestamp"))); + 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 ("block_account"), i->second.get ("local_timestamp"))); } ASSERT_EQ (4, history_l.size ()); ASSERT_EQ ("send", std::get<0> (history_l[0])); diff --git a/nano/node/rpc.cpp b/nano/node/rpc.cpp index 543ddd834c..1f26f29771 100644 --- a/nano/node/rpc.cpp +++ b/nano/node/rpc.cpp @@ -3519,12 +3519,15 @@ void nano::rpc_handler::wallet_history () if (block != nullptr && timestamp >= modified_since && timestamp != std::numeric_limits::max ()) { boost::property_tree::ptree entry; - entry.put ("wallet_account", account.to_account ()); - entry.put ("hash", hash.to_string ()); history_visitor visitor (*this, false, block_transaction, entry, hash); block->visit (visitor); - entry.put ("local_timestamp", std::to_string (timestamp)); - entries.insert (std::make_pair (timestamp, entry)); + if (!entry.empty ()) + { + entry.put ("block_account", account.to_account ()); + entry.put ("hash", hash.to_string ()); + entry.put ("local_timestamp", std::to_string (timestamp)); + entries.insert (std::make_pair (timestamp, entry)); + } hash = block->previous (); } else