Skip to content

Include payment hash in more early payment logs#2515

Merged
TheBlueMatt merged 2 commits intolightningdevkit:mainfrom
TheBlueMatt:2023-08-earlier-payment-hash-log
Aug 23, 2023
Merged

Include payment hash in more early payment logs#2515
TheBlueMatt merged 2 commits intolightningdevkit:mainfrom
TheBlueMatt:2023-08-earlier-payment-hash-log

Conversation

@TheBlueMatt
Copy link
Copy Markdown
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
Copy Markdown

codecov-commenter commented Aug 23, 2023

Codecov Report

❌ Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.52%. Comparing base (0c25046) to head (5a1f212).
⚠️ Report is 5517 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/ln/outbound_payment.rs 77.77% 2 Missing ⚠️
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     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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