lnd icon indicating copy to clipboard operation
lnd copied to clipboard

Allow zero amount paths with MinHTLC policies

Open a-mpch opened this issue 6 months ago • 6 comments

Change Description

Skip returning error when building blinded paths amount is zero and channel has a greater MinHTLC policy. This fixes #9256

Previously, building blinded paths would fail when ValueMsat was 0 (zero amount payments) and intermediate channels had MinHTLC policies greater than zero. This prevented creation of blinded path invoices for zero amount payments.

The fix adds a condition to skip MinHTLC validation during path construction when ValueMsat is 0, since zero amount indicates the sender will decide the final payment amount. MinHTLC constraints will still be validated at payment time from the sender's perspective.

Steps to Test

Added a test make unit pkg=routing/blindedpath case=TestBuildBlindedPathZeroAmount and can be tested on a regtest network running licli addinvoice --blind --amt 0

Pull Request Checklist

Testing

  • [x] Your PR passes all CI checks.
  • [x] Tests covering the positive and negative (error paths) are included.
  • [x] Bug fixes contain tests triggering the bug to prevent regressions.

Code Style and Documentation

📝 Please see our Contribution Guidelines for further guidance.

a-mpch avatar Jul 02 '25 16:07 a-mpch

/gemini review

yyforyongyu avatar Jul 09 '25 18:07 yyforyongyu

I guess gemini is counting differently the 80 character long 👀 as example

		// 2) The new minHTLC value does not violate the sender amount.

has 79 columns

a-mpch avatar Jul 09 '25 18:07 a-mpch

Thanks for the review @Abdulkbk!

a-mpch avatar Aug 18 '25 20:08 a-mpch

@yyforyongyu any input on this PR or maybe who can I reach out to?

a-mpch avatar Aug 21 '25 19:08 a-mpch

I don't think a zero amount makes sense especially with BOLT12 offer where an invoice can be fetched just in time with the proper Amount, can you explain use-cases for this ?

ziggie1984 avatar Nov 07 '25 12:11 ziggie1984

@yyforyongyu: review reminder @a-mpch, remember to re-request review from reviewers when ready

lightninglabs-deploy avatar Dec 12 '25 16:12 lightninglabs-deploy