Quality improvements for accounts_balances RPC#4228
Merged
clemahieu merged 1 commit intonanocurrency:developfrom May 15, 2023
Merged
Conversation
thsfs
commented
May 9, 2023
clemahieu
approved these changes
May 15, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Address issue reported by nanocurrency/nano-docs#665. Related to #4223, but this applies to
accounts_balancesRPC.accounts_balances
Request:
{ "action": "accounts_balances", "accounts": ["nano_3t6k35gi95xu6tergt6p69ck76ogmitsa8mnijtpxm9fkcm736xtoncuohr3", "nano_36uccgpjzhjsdbj44wm1y5hyz8gefx3wjpp1jircxt84nopxkxti5bzq1rnz", "nano_1hrts7hcoozxccnffoq9hqhngnn9jz783usapejm57ejtqcyz9dpso1bibuy"] }Response (note the second account number is a not found account -- it returns a 0 balance):
{ "balances": { "nano_3t6k35gi95xu6tergt6p69ck76ogmitsa8mnijtpxm9fkcm736xtoncuohr3": { "balance": "325586539664609129644855132177", "pending": "2309370929000000000000000000000000", "receivable": "2309370929000000000000000000000000" }, "nano_1hrts7hcoozxccnffoq9hqhngnn9jz783usapejm57ejtqcyz9dpso1bibuy": { "balance": "0", "pending": "0", "receivable": "0" } }, "errors": { "nano_36uccgpjzhjsdbj44wm1y5hyz8gefx3wjpp1jircxt84nopxkxti5bzq1rnz": "Bad account number" } }Request & Response when there are no errors:
Request:
{ "action": "accounts_frontiers", "accounts": ["nano_3t6k35gi95xu6tergt6p69ck76ogmitsa8mnijtpxm9fkcm736xtoncuohr3"] }Response:
{ "balances": { "nano_3t6k35gi95xu6tergt6p69ck76ogmitsa8mnijtpxm9fkcm736xtoncuohr3": { "balance": "325586539664609129644855132177", "pending": "2309370929000000000000000000000000", "receivable": "2309370929000000000000000000000000" } } }Request & Response when all entries return errors:
Request:
{ "action": "accounts_frontiers", "accounts": ["nano_36uccgpjzhjsdbj44wm1y5hyz8gefx3wjpp1jircxt84nopxkxti5bzq1rnz"] }Response:
{ "errors": { "nano_36uccgpjzhjsdbj44wm1y5hyz8gefx3wjpp1jircxt84nopxkxti5bzq1rnz": "Bad account number" } }