-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: truncate children in tx detail API to return at most 100 elements #350
Conversation
handlers/node_api.py
Outdated
# service we will truncate it and return only the latest 100 to show in the UI | ||
# (it might even be more than we should, maybe we should paginate in the future) | ||
if 'meta' in response and 'children' in response['meta']: | ||
response['meta']['children'] = response['meta']['children'][-100:] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Move 100 to the config.
response['meta']['children'] = response['meta']['children'][-100:] | |
response['meta']['children'] = response['meta']['children'][-TX_DAG_CHILDREN_CUTOFF:] |
Or MAX_TX_CHILDREN
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7dd79d0 done
handlers/node_api.py
Outdated
# service we will truncate it and return only the latest 100 to show in the UI | ||
# (it might even be more than we should, maybe we should paginate in the future) | ||
if 'meta' in response and 'children' in response['meta']: | ||
response['meta']['children'] = response['meta']['children'][-100:] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I think we can be stricter with this.
We can just cap at 20 instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you, 20 should be more than enough. But we are currently showing everything, so I prefer keeping it as a "big" number for now, and we can reduce it in the future if we prefer.
Motivation
There are networks with low quantity of transactions that remain for a long time without transactions. Because of that, the latest tx keeps being used by blocks as parent, so it list of children increases a lot. The explorer service lambda returns 502 for any response bigger than 6mb, so some transactions (https://explorer.testnet.hathor.network/transaction/00e161a6b0bee1781ea9300680913fb76fd0fac4acab527cd9626cc1514abdc9, for example) were not being loaded.
There's no reason for the UI to receive a list of 193k elements. We should paginate it, if we decide that it's important to show all of them. For now, we are truncating it and returning the latest 100 elements.
Acceptance Criteria
Security Checklist