Skip to content
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
merged 11 commits into from
Jun 6, 2024

Conversation

ellemouton
Copy link
Member

reopening #762
along with a commit that addresses the last review comment made in #763

ellemouton and others added 11 commits June 6, 2024 12:43
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.
@ellemouton ellemouton requested a review from bitromortac June 6, 2024 16:51
@ellemouton ellemouton force-pushed the tracing branch 3 times, most recently from a4f31aa to 5e07588 Compare June 6, 2024 17:10
Copy link
Contributor

@bitromortac bitromortac left a 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)

@ellemouton ellemouton merged commit 1e1a856 into lightninglabs:master Jun 6, 2024
24 checks passed
@ellemouton ellemouton deleted the tracing branch June 6, 2024 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants