Skip to content

Reject LSPS1 orders with the wrong refund address - #1131

Merged
tnull merged 1 commit into
lightningdevkit:mainfrom
benthecarman:lsps1-refund-address-validation
Oct 8, 2026
Merged

tnull merged 1 commit into
lightningdevkit:mainfrom
benthecarman:lsps1-refund-address-validation

Conversation

@benthecarman

Copy link
Copy Markdown
Contributor

When we create an LSPS1 order, we now check the refund address in the LSP's response. If the LSP returns an on-chain payment option whose refund_onchain_address doesn't match the one we sent, we reject the order. A response without the field is still accepted, since the field is optional.

This guards against buggy or misconfigured LSPs. It isn't theft protection: a malicious LSP can just decline to refund.

Reported by Project Loupe.

@ldk-reviews-bot

ldk-reviews-bot commented Oct 7, 2026 •

Copy link
Copy Markdown

👋 Thanks for assigning @tnull as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@ldk-reviews-bot
ldk-reviews-bot requested a review from tnull October 7, 2026 07:22
Comment thread src/liquidity/client/lsps1.rs Outdated
fn check_refund_address<'a>(
payment_options: &'a LSPS1PaymentInfo, expected: &bitcoin::Address,
) -> Result<(), &'a bitcoin::Address> {
match payment_options.onchain.as_ref().and_then(|o| o.refund_onchain_address.as_ref()) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just inline these 4 lines? Also no need to add 5 lines of comments for it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

When we create an LSPS1 order, we now check the refund address in the
LSP's response. If the LSP returns an on-chain payment option whose
refund_onchain_address doesn't match the one we sent, we reject the
order. A response without the field is still accepted, since the field
is optional.

This guards against buggy or misconfigured LSPs. It isn't theft
protection: a malicious LSP can just decline to refund.

Reported by Project Loupe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@benthecarman
benthecarman force-pushed the lsps1-refund-address-validation branch from 406b838 to 6b07d50 Compare October 7, 2026 18:32
@benthecarman
benthecarman requested a review from tnull October 7, 2026 18:33
@tnull
tnull merged commit 1dea48a into lightningdevkit:main Oct 8, 2026
16 of 25 checks passed
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