Skip to content

Commit

Permalink
Fixed 'account' field for state send subtype in 'account_history' RPC…
Browse files Browse the repository at this point in the history
… call (#819)
  • Loading branch information
eirikrye authored and clemahieu committed Apr 20, 2018
1 parent 9499c04 commit ef5cfee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rai/node/rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1731,7 +1731,7 @@ class history_visitor : public rai::block_visitor
{
tree.put ("type", "send");
}
tree.put ("account", block_a.hashables.account.to_account ());
tree.put ("account", block_a.hashables.link.to_account ());
tree.put ("amount", (previous_balance - balance).convert_to<std::string> ());
}
else
Expand Down

2 comments on commit ef5cfee

@PlasmaPower
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs updated to support the raw option. If requesting history via a head block, the requester may not know the account.

@eirikrye
Copy link
Contributor Author

@eirikrye eirikrye commented on ef5cfee Apr 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I realize now this commit is incomplete. It's still inconsistent with receive blocks. For legacy receive blocks, account_history returns the source account, but for subtype receive state blocks, it returns the block's account.

@PlasmaPower Doesn't it make more sense for head to return the chain's account -outside- the block list, e.g.:

$ curl -g -d '{ "action": "account_history", "head": "5041CE94BD875AA6B2DABB2051F91226F3CFA6467A2C69A761F6F0CDE3569364", "count": "2", "raw": "true" }' '[::1]:7076'
{
    "account": "xrb_14zt6dsi3ooamfmeja63xszfpkk35pinysetcdsp7nrh8t9ksx7emph8wozm",
    "history": [
        {
            "type": "state",
            "representative": "xrb_35jdmecuxmxbu13wjappphrsjqbuny9isjubniqegto5gf1p67i7tm78bfyd",
            "link": "B855795E278C013992C9C42D8754212E908902192C5A5C146A75E30448ECD58D",
            "subtype": "send",
            "account": "xrb_3g4oh7h4h51398bemj3fixc44dnij633kd4tdic8nxh51j6gsoefub1figad",
            "amount": "73447999999999999999999999999",
            "hash": "5041CE94BD875AA6B2DABB2051F91226F3CFA6467A2C69A761F6F0CDE3569364",
            "work": "3b8701f63117b42f",
            "signature": "ACE05EDE4228284CE6488F431D2E62417834BE6FDFE6A23E9A08B2C7BC8683BE7898FA591393F2302BC7B5F9C1122A96E659F9F54FEAB0E50E23C3F24A99FE03"
        },
[...]
} 

I don't get the point of repeating the same account over and over in the history list.

#818

Please sign in to comment.