-
Notifications
You must be signed in to change notification settings - Fork 100
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
accounts: address pendingPayments issues & add tracer #766
Merged
Conversation
This file contains 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
In preperation for the trace logging we want to implement in an upcoming commit (where logs for requests & responsescan be linked via their request ID), we start adding the request ID to an intercepted account request/response in this commit.
In preparation for implementing trace logging that makes it easy to link state across requests and responses for more informative logs, we add a new ReqIDToPaymentHashStore interface along with an in-memory implementation. This can be expanded in future to contain other state but for now let's just go with the payment hash since that is useful to have and will provide the user useful information about the payment corresponding to a log.
For all payment request handlers, start using the new ReqIDToPaymentHash store to store some state (just payment hash for now).
This commit adds a prefixed logger that is then used to log trace information about a payment. This will make it easy to see from the logs which account ID is making the request, what the request ID is and what the relavant payment hash is.
We also want to be able to see via the trace logs if a request has errored. So first we need to update the framework to be ready for this.
This commit refactors the in-flight check in the accounts service to its own function. The in-flight check is also inverted to only check the states that are not considered as in-flight. This makes the check forward-compatible with lnd `v0.18.0-beta` which introduces a new `lnrpc.Payment_INITIATED` state.
This commit ensures that a pending payment is associated with the specific account ID before deducting the in-flight balance from the available balance.
If an unknown payment turns out to be a not initiated payment, we should remove it so that the pending balance is freed up for the user.
a4f31aa
to
5e07588
Compare
bitromortac
approved these changes
Jun 6, 2024
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 ⚡ (reviewed on the original PR)
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.
reopening #762
along with a commit that addresses the last review comment made in #763