Fix stateblock receive account field to be consistent with legacy blocks (#820)
* Fix stateblock receive account field to be consistent with legacy blocks * Add account field to output of account_history RPC call * Only look up account if it is not provided in account_history RPC call
This commit is contained in:
parent
fbaac75550
commit
f48597fe74
1 changed files with 9 additions and 3 deletions
|
@ -1800,7 +1800,7 @@ public:
|
|||
{
|
||||
tree.put ("type", "receive");
|
||||
}
|
||||
tree.put ("account", block_a.hashables.account.to_account ());
|
||||
tree.put ("account", handler.node.ledger.account (transaction, block_a.hashables.link).to_account ());
|
||||
tree.put ("amount", (balance - previous_balance).convert_to<std::string> ());
|
||||
}
|
||||
}
|
||||
|
@ -1815,6 +1815,7 @@ public:
|
|||
|
||||
void rai::rpc_handler::account_history ()
|
||||
{
|
||||
std::string account_text;
|
||||
std::string count_text (request.get<std::string> ("count"));
|
||||
bool output_raw (request.get_optional<bool> ("raw") == true);
|
||||
auto error (false);
|
||||
|
@ -1824,14 +1825,18 @@ void rai::rpc_handler::account_history ()
|
|||
if (head_str)
|
||||
{
|
||||
error = hash.decode_hex (*head_str);
|
||||
if (error)
|
||||
if (!error)
|
||||
{
|
||||
account_text = node.ledger.account (transaction, hash).to_account ();
|
||||
}
|
||||
else
|
||||
{
|
||||
error_response (response, "Invalid block hash");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string account_text (request.get<std::string> ("account"));
|
||||
account_text = request.get<std::string> ("account");
|
||||
rai::uint256_union account;
|
||||
error = account.decode_account (account_text);
|
||||
if (!error)
|
||||
|
@ -1856,6 +1861,7 @@ void rai::rpc_handler::account_history ()
|
|||
boost::property_tree::ptree history;
|
||||
if (!error)
|
||||
{
|
||||
response_l.put ("account", account_text);
|
||||
auto block (node.store.block_get (transaction, hash));
|
||||
while (block != nullptr && count > 0)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue