Skip to content

Include payment hash in more early payment logs #2515

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

Merged

Conversation

TheBlueMatt
Copy link
Collaborator

@TheBlueMatt TheBlueMatt commented Aug 23, 2023

Based on #2492,

If a user has issues with a payment, the most obvious thing they'll
do is check logs for the payment hash. Thus, we should ensure our
logs that show a payment's lifecycle include the payment hash and
are emitted (a) as soon as LDK learns of the payment, (b) once the
payment goes out to the peer (which is already reasonably covered
in the commitment transaction building logs) and (c) when the
payment ultimately is fulfilled or fails.

Here we improve our logs for both (a) and (c).

As a nice bonus, we also remove a sha256 hash of a payment preimage in every forwarded HTLC claim :).

@codecov-commenter
Copy link

codecov-commenter commented Aug 23, 2023

Codecov Report

Patch coverage: 85.71% and project coverage change: -0.01% ⚠️

Comparison is base (0c25046) 90.53% compared to head (5a1f212) 90.52%.
Report is 14 commits behind head on main.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2515      +/-   ##
==========================================
- Coverage   90.53%   90.52%   -0.01%     
==========================================
  Files         107      107              
  Lines       56923    56931       +8     
  Branches    56923    56931       +8     
==========================================
+ Hits        51533    51537       +4     
- Misses       5390     5394       +4     
Files Changed Coverage Δ
lightning/src/ln/outbound_payment.rs 89.73% <77.77%> (-0.02%) ⬇️
lightning/src/ln/channel.rs 89.77% <100.00%> (-0.01%) ⬇️
lightning/src/ln/channelmanager.rs 87.19% <100.00%> (+<0.01%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

If a user has issues with a payment, the most obvious thing they'll
do is check logs for the payment hash. Thus, we should ensure our
logs that show a payment's lifecycle include the payment hash and
are emitted (a) as soon as LDK learns of the payment, (b) once the
payment goes out to the peer (which is already reasonably covered
in the commitment transaction building logs) and (c) when the
payment ultimately is fulfilled or fails.

Here we improve our logs for both (a) and (c).
Currently, when we receive an HTLC claim from a peer, we first hash
the preimage they gave us before removing the HTLC, then
immediately pass the preimage to the inbound channel and hash the
preimage again before removing the HTLC and sending our peer an
`update_fulfill_htlc`. This second hash is actually only asserted
on, never used in any meaningful way as we have the htlc data
present in the same code.

Here we simply drop this second hash and move it into a
`debug_assert`.
@TheBlueMatt TheBlueMatt force-pushed the 2023-08-earlier-payment-hash-log branch from 5016084 to 5a1f212 Compare August 23, 2023 16:45
@TheBlueMatt TheBlueMatt merged commit bbe20c3 into lightningdevkit:main Aug 23, 2023
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.

4 participants