Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Changes the accounts_frontiers RPC to return per account results #3791

Merged
merged 3 commits into from
Apr 14, 2022

Conversation

thsfs
Copy link
Contributor

@thsfs thsfs commented Apr 13, 2022

The previous implementation returned only an error result in case any of the accounts were invalid. This implementation now handles each account separately returning per account results. It returns an empty string when the account's frontier is zero, and returns an error message for when the provided account is invalid.

Example:

    "frontiers": {
        "nano_3wfddg7a1paogrcwi3yhwnaerboukbr7rs3z3ino5toyq3yyhimo6f6egij6": "75BD65296241EB871918EBE3E99E9A191970A2724B3214B27F8AB205FF4FC30A",
        "nano_36uccgpjzhjsdbj44wm1y5hyz8gefx3wjpp1jircxt84nopxkxti5bzq1rnz": "error: Bad account number",
        "nano_1hrts7hcoozxccnffoq9hqhngnn9jz783usapejm57ejtqcyz9dpso1bibuy": "error: Account not found"
    }

Reference issue: #3752

@thsfs thsfs added this to the V24.0 milestone Apr 13, 2022
@thsfs thsfs added the rpc Changes related to Remote Procedure Calls label Apr 13, 2022
@thsfs thsfs force-pushed the accounts_frontiers_per_item_response branch from 7cae7fb to c4ca179 Compare April 13, 2022 17:07
@thsfs thsfs requested a review from dsiganos April 13, 2022 17:09
@dsiganos
Copy link
Contributor

The "feature" where we correct accounts, sounds like an unnecessary complication that we should remove.
If we get a bad account, we shouldn't try to fix it, we should just return an error.
Where does that autofixing happen?

@thsfs
Copy link
Contributor Author

thsfs commented Apr 13, 2022

The "feature" where we correct accounts, sounds like an unnecessary complication that we should remove. If we get a bad account, we shouldn't try to fix it, we should just return an error. Where does that autofixing happen?

In the account_impl (...) function, if you look at the code segment:

...
		if (result.decode_account (account_text))
		{
			ec = ec_a;
		}
...

The decode_account function returns a corrected number.

But, in anyway, this PR is handling it correctly by using the requested account number (account_from_request) instead of the corrected one.

clemahieu
clemahieu previously approved these changes Apr 14, 2022
dsiganos
dsiganos previously approved these changes Apr 14, 2022
@thsfs thsfs dismissed stale reviews from dsiganos and clemahieu via 6e40140 April 14, 2022 15:02
@thsfs
Copy link
Contributor Author

thsfs commented Apr 14, 2022

Added a new unit test for it.

clemahieu
clemahieu previously approved these changes Apr 14, 2022
A simpler test case for accounts_frontiers

Co-authored-by: Dimitrios Siganos <dimitris@siganos.org>
@thsfs thsfs force-pushed the accounts_frontiers_per_item_response branch from 2497b27 to 9295ddc Compare April 14, 2022 18:42
dsiganos
dsiganos previously approved these changes Apr 14, 2022
@thsfs thsfs merged commit c647b6b into develop Apr 14, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
rpc Changes related to Remote Procedure Calls
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants