Skip to content

Fix injectpaymentonion fees#9008

Open
Lagrang3 wants to merge 4 commits intoElementsProject:masterfrom
Lagrang3:fix-injectpaymentonion-fees
Open

Fix injectpaymentonion fees#9008
Lagrang3 wants to merge 4 commits intoElementsProject:masterfrom
Lagrang3:fix-injectpaymentonion-fees

Conversation

@Lagrang3
Copy link
Copy Markdown
Collaborator

@Lagrang3 Lagrang3 commented Mar 31, 2026

Fixes issue #9006.

According to the description of injectpaymentonion this command simulates an incoming htlc from a peer.
The onion to us contains the information to deduce the next hop.
To be consistent with this this description, the command parameter amount_msat should correspond to the
amount the peer has provided to us and not the amount we should forward to our next peer.

The intention is deduced from this statement

	payload = onion_decode(tmpctx, rs, blinding,
			       cmd->ld->accept_extra_tlv_types,
			       *msat, *cltv,
			       &failtlvtype,
			       &failtlvpos,
			       &explanation);

msat is the amount_msat parameter from the RPC, therefore is interpreted as the amount_in.
We did not see this before because we were using auto.sourcefree layer.

@Lagrang3 Lagrang3 force-pushed the fix-injectpaymentonion-fees branch from 0e0bfdc to 30fc0d9 Compare March 31, 2026 09:03
@Lagrang3 Lagrang3 marked this pull request as ready for review March 31, 2026 09:03
@Lagrang3 Lagrang3 requested a review from cdecker as a code owner March 31, 2026 09:03
@Lagrang3 Lagrang3 marked this pull request as draft March 31, 2026 09:04
Changelog-None

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
@Lagrang3 Lagrang3 force-pushed the fix-injectpaymentonion-fees branch 2 times, most recently from 3f2ad53 to ad44228 Compare March 31, 2026 10:09
@Lagrang3 Lagrang3 marked this pull request as ready for review March 31, 2026 10:10
Changelog-Fixed: injectpayment_onion: fix fees for blinded paths, treat amount_msat as the incoming amount and not the forward amount.

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
@Lagrang3 Lagrang3 force-pushed the fix-injectpaymentonion-fees branch from ad44228 to 8b80ed8 Compare March 31, 2026 10:12
Changelog-None

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
@Lagrang3 Lagrang3 force-pushed the fix-injectpaymentonion-fees branch from 36ed233 to da14a54 Compare March 31, 2026 13:28
@Lagrang3
Copy link
Copy Markdown
Collaborator Author

At this point da14a54 we don't need auto.sourcefree anymore in xpay.

Changelog-None

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
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.

1 participant