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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -4347,10 +4347,14 @@ func (r *rpcServer) extractPaymentIntent(rpcPayReq *rpcPaymentRequest) (rpcPayme
return payIntent, errors.New("invalid payment address length")
}

if payIntent.paymentAddr == nil {
// Set the payment address if it was explicitly defined with the
// rpcPaymentRequest.
// Note that the payment address for the payIntent should be nil if none
// was provided with the rpcPaymentRequest.
if len(rpcPayReq.PaymentAddr) != 0 {
payIntent.paymentAddr = &[32]byte{}
copy(payIntent.paymentAddr[:], rpcPayReq.PaymentAddr)
}
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.


// Otherwise, If the payment request field was not specified
// (and a custom route wasn't specified), construct the payment
Expand Down