Skip to content
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

lnd: only set payment address if not empty in PaymentRequest #5419

Merged

Conversation

bjarnemagnussen
Copy link
Contributor

Background

This PR addresses an issue where not defining a payment address with the SendPaymentRequest results in a payment_incorrect_details error for:

  • keysend payments, and
  • in LND versions <=0.11 when defining the payment directly using the pubkey in Dest and PaymentHash instead of using an invoice with PaymentRequest.

The error occurs as not defining a payment address with the SendPaymentRequest results in an empty payment address byte array in the paymentIntent instead of a nil-value.

fixes #5413

@Crypt-iQ Crypt-iQ added bug fix rpc Related to the RPC interface labels Jun 22, 2021
@Roasbeef Roasbeef added this to the 0.13.1 milestone Jun 23, 2021
Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

Solid fix! IMO the only thing missing here is updating the itests (testSingleHopInvoice) to account for this change. Looking at the existing test case for keysend we have I don't see how this wasn't already covered, given the request is identical to the proto sample you posted in the original issue.

}
copy(payIntent.paymentAddr[:], rpcPayReq.PaymentAddr)
Copy link
Member

Choose a reason for hiding this comment

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

Ahh, so this ended up copying a zero valued payment address, which was rejected as it's used as a shibboleth elsewhere in the codebase.

@Roasbeef
Copy link
Member

I don't see how this wasn't already covered, given the request is identical to the proto sample you posted in the original issue.

Ah I think the difference here is all our itests use SendPaymentV2 and not the deprecated variant on the main Lightning service.

@bjarnemagnussen
Copy link
Contributor Author

bjarnemagnussen commented Jun 24, 2021

Right, I was also wondering why the itest hadn't picked this up but just as you mention it is not tested for this SendPayment (probably due to deprecation?).

I should have probably made it more clear in the PR!

@Roasbeef
Copy link
Member

NP, it all makes sense now, and also explains why we didn't catch this when testing on the CLI as the CLI uses all the v2 calls. Given that we worked to move all the integration tests over to using the v2 APIs, I think this can land as is.

Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

LGTM 🛰

Ran the itests locally, it's hitting some failures due to a regression (after 0.13) that #5429 should fix.

@Roasbeef Roasbeef merged commit 6a97e64 into lightningnetwork:master Jun 24, 2021
@bjarnemagnussen bjarnemagnussen deleted the upstream/fix-no-payment-address branch June 25, 2021 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fix rpc Related to the RPC interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Keysend using gRPC lnrpc.Lightning.SendPayment fails if PaymentAddr is empty
3 participants