-
Notifications
You must be signed in to change notification settings - Fork 38
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
Move public tx listing API to host DB query #1900
Conversation
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.
LGTM, couple minor things
"fmt" | ||
"math/big" | ||
|
||
common2 "github.com/ethereum/go-ethereum/common" |
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.
Something's gone awry here, this looks the same as the gethcommon
import below (which is the naming convention we've been using, Goland autogenerates common2 sometimes).
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.
Kinda crappy that the linter doesn't pick this up...
query := selectTxs + db.GetSQLStatement().Pagination | ||
rows, err := db.GetSQLDB().Query(query, pagination.Size, pagination.Offset) | ||
if err != nil { | ||
return nil, err |
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.
It's a pain in the ass but good practice to wrap all these errors with a short description, because it makes it easier to figure out what step an error came from when debugging.
e.g. return nil, fmt.Errorf("unable to execute query - %w", err)
There's a couple more of these return errs below so be good to remove the ambiguity with them too 🙏
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.
j'approve
Why this change is needed
We currently query this from the enclave client but its producing some strange pagination errors and we don't need to access the enclave for this data now we have it in the host DB.
https://github.com/ten-protocol/ten-internal/issues/3324
What changes were made as part of this PR
FetchTransactions
API to the host DBEnclaveClient
to the new host interface methodtransactions_host
>transaction_host
to match naming conventionEnclaveClient
APIPR checks pre-merging
Please indicate below by ticking the checkbox that you have read and performed the required
PR checks