Skip to content

Commit

Permalink
show weight and receivable for unopened accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
gr0vity-dev committed Mar 28, 2024
1 parent 34dbb91 commit fcf9af2
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions nano/node/json_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,24 @@ void nano::json_handler::account_info ()
auto info (account_info_impl (transaction, account));
nano::confirmation_height_info confirmation_height_info;
node.store.confirmation_height.get (transaction, account, confirmation_height_info);
if (weight)
{
auto account_weight (node.ledger.weight (account));
response_l.put ("weight", account_weight.convert_to<std::string> ());
}
if (receivable)
{
auto account_receivable = node.ledger.account_receivable (transaction, account);
response_l.put ("pending", account_receivable.convert_to<std::string> ());
response_l.put ("receivable", account_receivable.convert_to<std::string> ());

if (include_confirmed)
{
auto account_receivable = node.ledger.account_receivable (transaction, account, true);
response_l.put ("confirmed_pending", account_receivable.convert_to<std::string> ());
response_l.put ("confirmed_receivable", account_receivable.convert_to<std::string> ());
}
}
if (!ec)
{
response_l.put ("frontier", info.head.to_string ());
Expand Down Expand Up @@ -692,24 +710,6 @@ void nano::json_handler::account_info ()
response_l.put ("confirmed_representative", confirmed_representative.to_account ());
}
}
if (weight)
{
auto account_weight (node.ledger.weight_exact (transaction, account));
response_l.put ("weight", account_weight.convert_to<std::string> ());
}
if (receivable)
{
auto account_receivable = node.ledger.account_receivable (transaction, account);
response_l.put ("pending", account_receivable.convert_to<std::string> ());
response_l.put ("receivable", account_receivable.convert_to<std::string> ());

if (include_confirmed)
{
auto account_receivable = node.ledger.account_receivable (transaction, account, true);
response_l.put ("confirmed_pending", account_receivable.convert_to<std::string> ());
response_l.put ("confirmed_receivable", account_receivable.convert_to<std::string> ());
}
}
}
}
response_errors ();
Expand Down

0 comments on commit fcf9af2

Please sign in to comment.